etendo-ui-library 1.3.81 → 1.3.82

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
1
  import React from 'react';
2
2
  import { InputProps } from './Input.types';
3
- declare const Input: ({ value, titleLabel, titleImage, helperText, placeholder, placeholderPickerSearch, disabled, maxLength, centerText, keyboardType, displayKey, dataPicker, backgroundColor, showOptionsAmount, showSearchInPicker, height, onPress, onSubmit, onFocus, onBlur, onChangeText, onOptionSelected, typeField, isError, language, dateFormat, showCalendar, }: InputProps) => React.JSX.Element;
3
+ declare const Input: ({ value, titleLabel, titleImage, helperText, placeholder, placeholderPickerSearch, disabled, maxLength, centerText, keyboardType, displayKey, dataPicker, backgroundColor, showOptionsAmount, showSearchInPicker, height, onPress, onSubmit, onFocus, onBlur, onChangeText, onOptionSelected, typeField, isError, language, dateFormat, showCalendar, currentPage, isLoadingMoreData, onLoadMoreData, isPagination, isStopLoadMoreData, }: InputProps) => React.JSX.Element;
4
4
  export default Input;
@@ -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 _Input=require("./Input.style");var _index=require("./index");var _colors=require("../../styles/colors");var _this=this,_jsxFileName="/home/jenkins/agent/workspace/etendo_ui_library_develop/etendo_ui_library/src/components/input/Input.tsx";var Input=function Input(_ref){var value=_ref.value,titleLabel=_ref.titleLabel,titleImage=_ref.titleImage,helperText=_ref.helperText,placeholder=_ref.placeholder,placeholderPickerSearch=_ref.placeholderPickerSearch,_ref$disabled=_ref.disabled,disabled=_ref$disabled===void 0?false:_ref$disabled,maxLength=_ref.maxLength,centerText=_ref.centerText,keyboardType=_ref.keyboardType,displayKey=_ref.displayKey,dataPicker=_ref.dataPicker,_ref$backgroundColor=_ref.backgroundColor,backgroundColor=_ref$backgroundColor===void 0?_colors.NEUTRAL_50:_ref$backgroundColor,showOptionsAmount=_ref.showOptionsAmount,showSearchInPicker=_ref.showSearchInPicker,height=_ref.height,onPress=_ref.onPress,onSubmit=_ref.onSubmit,_ref$onFocus=_ref.onFocus,onFocus=_ref$onFocus===void 0?function(){}:_ref$onFocus,_ref$onBlur=_ref.onBlur,onBlur=_ref$onBlur===void 0?function(){}:_ref$onBlur,onChangeText=_ref.onChangeText,onOptionSelected=_ref.onOptionSelected,typeField=_ref.typeField,isError=_ref.isError,language=_ref.language,dateFormat=_ref.dateFormat,showCalendar=_ref.showCalendar;var stateStyle=function stateStyle(){if(typeField==='readOnly'){return _Input.inputStyleVariants.readOnly;}else if(getDisabled()){return _Input.inputStyleVariants.disabled;}else if(isError){return _Input.inputStyleVariants.destructive;}else{return _Input.inputStyleVariants.default;}};var getDisabled=function getDisabled(){if(typeField==='picker'){return!(dataPicker!=null&&dataPicker.length)||disabled;}if(typeField==='readOnly'){return false;}return disabled;};var showFilterSearch=dataPicker&&(showSearchInPicker!=null?showSearchInPicker:(dataPicker==null?void 0:dataPicker.length)>16);return _react.default.createElement(_reactNative.View,{style:_Input.styles.inputContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:63,columnNumber:5}},_react.default.createElement(_index.InputTitle,{disabled:getDisabled(),titleLabel:titleLabel,titleImage:titleImage,styleTitle:stateStyle().titleStyle,__self:_this,__source:{fileName:_jsxFileName,lineNumber:64,columnNumber:7}}),_react.default.createElement(_index.InputField,{disabled:getDisabled(),type:typeField,configField:_Input.inputVariants[typeField].field,styleField:stateStyle().fieldStyle,placeholder:placeholder,placeholderPickerSearch:placeholderPickerSearch,value:value,onPress:onPress,onSubmit:onSubmit,onFocus:onFocus,onBlur:onBlur,onChangeText:onChangeText,onOptionSelected:onOptionSelected,showOptionsAmount:showOptionsAmount,showSearchInPicker:showFilterSearch,keyboardType:keyboardType,maxLength:maxLength,centerText:centerText,dataPicker:dataPicker,displayKey:displayKey,backgroundColor:backgroundColor,height:height,language:language,dateFormat:dateFormat,showCalendar:showCalendar,__self:_this,__source:{fileName:_jsxFileName,lineNumber:70,columnNumber:7}}),_react.default.createElement(_index.InputHelperText,{label:helperText,styleHelper:stateStyle().helperStyle,__self:_this,__source:{fileName:_jsxFileName,lineNumber:97,columnNumber:7}}));};var _default=exports.default=Input;
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 _Input=require("./Input.style");var _index=require("./index");var _colors=require("../../styles/colors");var _this=this,_jsxFileName="/home/jenkins/agent/workspace/etendo_ui_library_develop/etendo_ui_library/src/components/input/Input.tsx";var Input=function Input(_ref){var value=_ref.value,titleLabel=_ref.titleLabel,titleImage=_ref.titleImage,helperText=_ref.helperText,placeholder=_ref.placeholder,placeholderPickerSearch=_ref.placeholderPickerSearch,_ref$disabled=_ref.disabled,disabled=_ref$disabled===void 0?false:_ref$disabled,maxLength=_ref.maxLength,centerText=_ref.centerText,keyboardType=_ref.keyboardType,displayKey=_ref.displayKey,dataPicker=_ref.dataPicker,_ref$backgroundColor=_ref.backgroundColor,backgroundColor=_ref$backgroundColor===void 0?_colors.NEUTRAL_50:_ref$backgroundColor,showOptionsAmount=_ref.showOptionsAmount,showSearchInPicker=_ref.showSearchInPicker,height=_ref.height,onPress=_ref.onPress,onSubmit=_ref.onSubmit,_ref$onFocus=_ref.onFocus,onFocus=_ref$onFocus===void 0?function(){}:_ref$onFocus,_ref$onBlur=_ref.onBlur,onBlur=_ref$onBlur===void 0?function(){}:_ref$onBlur,onChangeText=_ref.onChangeText,onOptionSelected=_ref.onOptionSelected,typeField=_ref.typeField,isError=_ref.isError,language=_ref.language,dateFormat=_ref.dateFormat,showCalendar=_ref.showCalendar,currentPage=_ref.currentPage,isLoadingMoreData=_ref.isLoadingMoreData,onLoadMoreData=_ref.onLoadMoreData,isPagination=_ref.isPagination,isStopLoadMoreData=_ref.isStopLoadMoreData;var stateStyle=function stateStyle(){if(typeField==='readOnly'){return _Input.inputStyleVariants.readOnly;}else if(getDisabled()){return _Input.inputStyleVariants.disabled;}else if(isError){return _Input.inputStyleVariants.destructive;}else{return _Input.inputStyleVariants.default;}};var getDisabled=function getDisabled(){if(typeField==='picker'){return!(dataPicker!=null&&dataPicker.length)||disabled;}if(typeField==='readOnly'){return false;}return disabled;};var showFilterSearch=dataPicker&&(showSearchInPicker!=null?showSearchInPicker:(dataPicker==null?void 0:dataPicker.length)>16);return _react.default.createElement(_reactNative.View,{style:_Input.styles.inputContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:68,columnNumber:5}},_react.default.createElement(_index.InputTitle,{disabled:getDisabled(),titleLabel:titleLabel,titleImage:titleImage,styleTitle:stateStyle().titleStyle,__self:_this,__source:{fileName:_jsxFileName,lineNumber:69,columnNumber:7}}),_react.default.createElement(_index.InputField,{disabled:getDisabled(),type:typeField,configField:_Input.inputVariants[typeField].field,styleField:stateStyle().fieldStyle,placeholder:placeholder,placeholderPickerSearch:placeholderPickerSearch,value:value,onPress:onPress,onSubmit:onSubmit,onFocus:onFocus,onBlur:onBlur,onChangeText:onChangeText,onOptionSelected:onOptionSelected,showOptionsAmount:showOptionsAmount,showSearchInPicker:showFilterSearch,keyboardType:keyboardType,maxLength:maxLength,centerText:centerText,dataPicker:dataPicker,displayKey:displayKey,backgroundColor:backgroundColor,height:height,language:language,dateFormat:dateFormat,showCalendar:showCalendar,currentPage:currentPage,onLoadMoreData:onLoadMoreData,isLoadingMoreData:isLoadingMoreData,isPagination:isPagination,isStopLoadMoreData:isStopLoadMoreData,__self:_this,__source:{fileName:_jsxFileName,lineNumber:75,columnNumber:7}}),_react.default.createElement(_index.InputHelperText,{label:helperText,styleHelper:stateStyle().helperStyle,__self:_this,__source:{fileName:_jsxFileName,lineNumber:107,columnNumber:7}}));};var _default=exports.default=Input;
@@ -68,6 +68,11 @@ export interface InputProps {
68
68
  language?: LanguageFormat;
69
69
  dateFormat?: DateFormat;
70
70
  showCalendar?: boolean;
71
+ isLoadingMoreData?: boolean;
72
+ onLoadMoreData?: (currentPage?: number, filterText?: string) => void;
73
+ currentPage?: number;
74
+ isPagination?: boolean;
75
+ isStopLoadMoreData?: boolean;
71
76
  }
72
77
  export interface InputTitleProps {
73
78
  titleLabel?: string;
@@ -112,6 +117,11 @@ export interface InputFieldProps {
112
117
  onBlur: (event?: NativeSyntheticEvent<TextInputFocusEventData>) => void;
113
118
  dateFormat?: any;
114
119
  showCalendar?: boolean;
120
+ isLoadingMoreData?: boolean;
121
+ onLoadMoreData?: (currentPage?: number, filterText?: string) => void;
122
+ currentPage?: number;
123
+ isPagination?: boolean;
124
+ isStopLoadMoreData?: boolean;
115
125
  }
116
126
  export interface InputHelperProps {
117
127
  styleHelper: TextStyle | TextStyle[];
@@ -137,4 +147,9 @@ export interface InputOptionsProps {
137
147
  placeholderPickerSearch?: string;
138
148
  optionsTop: boolean;
139
149
  dataPicker: any;
150
+ isLoadingMoreData?: boolean;
151
+ onLoadMoreData?: (currentPage?: number, filterText?: string) => void;
152
+ currentPage?: number;
153
+ isPagination?: boolean;
154
+ isStopLoadMoreData?: boolean;
140
155
  }
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { InputFieldProps } from '../Input.types';
3
- declare const InputField: ({ type, configField, styleField, value, disabled, placeholder, placeholderPickerSearch, maxLength, keyboardType, dataPicker, displayKey, showSearchInPicker, backgroundColor, showOptionsAmount, height, onPress, onSubmit, onChangeText, onOptionSelected, onFocus, onBlur, language, dateFormat, showCalendar, }: InputFieldProps) => React.JSX.Element;
3
+ declare const InputField: ({ type, configField, styleField, value, disabled, placeholder, placeholderPickerSearch, maxLength, keyboardType, dataPicker, displayKey, showSearchInPicker, backgroundColor, showOptionsAmount, height, onPress, onSubmit, onChangeText, onOptionSelected, onFocus, onBlur, language, dateFormat, showCalendar, isLoadingMoreData, onLoadMoreData, currentPage, isPagination, isStopLoadMoreData, }: InputFieldProps) => React.JSX.Element;
4
4
  export default InputField;
@@ -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 _Input=require("../Input.style");var _Input2=require("../Input.types");var _ShowPasswordIcon=require("../../../assets/images/icons/ShowPasswordIcon");var _HidePasswordIcon=require("../../../assets/images/icons/HidePasswordIcon");var _InputOptions=_interopRequireDefault(require("./InputOptions"));var _DatePicker=_interopRequireDefault(require("../../datepicker/DatePicker"));var _colors=require("../../../styles/colors");var _table_utils=require("../../../helpers/table_utils");var _this=this,_jsxFileName="/home/jenkins/agent/workspace/etendo_ui_library_develop/etendo_ui_library/src/components/input/components/InputField.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 InputField=function InputField(_ref){var type=_ref.type,configField=_ref.configField,styleField=_ref.styleField,value=_ref.value,disabled=_ref.disabled,placeholder=_ref.placeholder,placeholderPickerSearch=_ref.placeholderPickerSearch,maxLength=_ref.maxLength,keyboardType=_ref.keyboardType,dataPicker=_ref.dataPicker,displayKey=_ref.displayKey,showSearchInPicker=_ref.showSearchInPicker,_ref$backgroundColor=_ref.backgroundColor,backgroundColor=_ref$backgroundColor===void 0?_colors.NEUTRAL_0:_ref$backgroundColor,showOptionsAmount=_ref.showOptionsAmount,_ref$height=_ref.height,height=_ref$height===void 0?40:_ref$height,onPress=_ref.onPress,onSubmit=_ref.onSubmit,onChangeText=_ref.onChangeText,onOptionSelected=_ref.onOptionSelected,onFocus=_ref.onFocus,onBlur=_ref.onBlur,language=_ref.language,dateFormat=_ref.dateFormat,showCalendar=_ref.showCalendar;var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),isFocus=_useState2[0],setIsFocus=_useState2[1];var _useState3=(0,_react.useState)(true),_useState4=(0,_slicedToArray2.default)(_useState3,2),showPassword=_useState4[0],setShowPassword=_useState4[1];var _useState5=(0,_react.useState)(false),_useState6=(0,_slicedToArray2.default)(_useState5,2),showOptions=_useState6[0],setShowOptions=_useState6[1];var _useState7=(0,_react.useState)([]),_useState8=(0,_slicedToArray2.default)(_useState7,2),dataOptionsFilter=_useState8[0],setDataOptionsFilter=_useState8[1];var _useState9=(0,_react.useState)(''),_useState10=(0,_slicedToArray2.default)(_useState9,2),filterValue=_useState10[0],setFilterValue=_useState10[1];var _useState11=(0,_react.useState)(false),_useState12=(0,_slicedToArray2.default)(_useState11,2),optionsTop=_useState12[0],setOptionsTop=_useState12[1];var _useState13=(0,_react.useState)({top:0,left:0,width:0,height:0}),_useState14=(0,_slicedToArray2.default)(_useState13,2),positionModal=_useState14[0],setPositionModal=_useState14[1];var windowHeight=_reactNative.Dimensions.get('window').height;var refComponent=(0,_react.useRef)(null);var regex=/^[0-9.,]+$/g;var getStyleText=function getStyleText(){var style=[];if(value){style.push(styleField.textDefault);}else{style.push(styleField.textPlaceholder);}return style;};(0,_react.useEffect)(function(){setDataOptionsFilter(dataPicker);if(showOptions){getTopLeft();}},[dataPicker]);var getTopLeft=function getTopLeft(){if(refComponent.current){refComponent.current.measure(function(x,y,width,height,pageX,pageY){var calcDropdownTopLeft=pageY+height+_Input.styles.spaceInOptionsAndInput.height;var showFilterHeight=showSearchInPicker?_Input.styles.optionFilterContainer.height:0;var optionsHeight=_Input.styles.optionContainer.height+_Input.styles.optionContainer.marginTop+showFilterHeight+_Input.styles.optionContainer.marginTop+_Input.styles.optionsContainer.borderWidth*2;var topPosition,bottomPosition;if(optionsHeight+calcDropdownTopLeft+_Input.styles.offSet.height>windowHeight){topPosition=pageY-optionsHeight;setOptionsTop(true);}else{topPosition=calcDropdownTopLeft;setOptionsTop(false);}bottomPosition=windowHeight-(topPosition+optionsHeight);setPositionModal({top:topPosition,bottom:bottomPosition,left:pageX,width:width,height:height});});}};var handleOnChangeFilterText=function handleOnChangeFilterText(filterText){setFilterValue(filterText);if(displayKey)setDataOptionsFilter(dataPicker.filter(function(item){return item[displayKey].toLocaleLowerCase().includes(filterText.toLocaleLowerCase());}));};var handleOnClose=function handleOnClose(){setShowOptions(false);setDataOptionsFilter(dataPicker);setFilterValue('');};var getKeyboardType=function getKeyboardType(keyboardType){if(keyboardType==='number'){return'numeric';}return'default';};var getOnChangeText=function getOnChangeText(text){if(onChangeText){if(keyboardType==='number'){if(text.match(regex)||(text==null?void 0:text.length)===0){onChangeText(text);}return;}onChangeText(text);}};var getFocusStyle=function getFocusStyle(){var style=[];if(!isFocus){style.push({borderColor:'transparent'});}return style;};var removePaddingField=function removePaddingField(){var style={};if(configField!=null&&configField.image){style={paddingRight:0};}return style;};var onPressFocus=function onPressFocus(event){onFocus(event);setIsFocus(true);};var onPressBlur=function onPressBlur(event){onBlur(event);setIsFocus(false);};var getImage=function getImage(image){var fillValue=disabled?_colors.NEUTRAL_400:undefined;if(type===_Input2.InputFieldVariant.TextInputPassword){var PasswordComponent=showPassword?_HidePasswordIcon.HidePasswordIcon:_ShowPasswordIcon.ShowPasswordIcon;return _react.default.createElement(PasswordComponent,{style:_Input.styles.inputImageSize,fill:fillValue,__self:_this,__source:{fileName:_jsxFileName,lineNumber:209,columnNumber:9}});}return _react.default.cloneElement(image,{fill:fillValue});};var handlePressImage=function handlePressImage(){if(type===_Input2.InputFieldVariant.TextInputPassword){setShowPassword(function(prevState){return!prevState;});}else{onSubmit==null?void 0:onSubmit();}};var handleOnPress=function handleOnPress(event){if(type===_Input2.InputFieldVariant.Picker){getTopLeft();setShowOptions(true);}if(onPress){onPress(event);}};var getText=function getText(){if(value){return value;}return placeholder;};var isAreaDisabled=function isAreaDisabled(){return disabled||configField.disabledSubmit||!onSubmit&&type!==_Input2.InputFieldVariant.TextInputPassword;};return configField!=null&&configField.isDatePicker?_react.default.createElement(_DatePicker.default,{dateFormat:dateFormat,language:language,styleField:styleField,onChangeText:onChangeText,value:value,showCalendar:showCalendar,disabled:disabled,backgroundColor:backgroundColor,__self:_this,__source:{fileName:_jsxFileName,lineNumber:249,columnNumber:5}}):_react.default.createElement(_reactNative.View,{style:[styleField.focus,getFocusStyle()],__self:_this,__source:{fileName:_jsxFileName,lineNumber:260,columnNumber:5}},_react.default.createElement(_reactNative.TouchableOpacity,{ref:refComponent,style:[styleField.field,removePaddingField(),{backgroundColor:backgroundColor},{height:height}],disabled:disabled||configField.disabledField,onPress:handleOnPress,__self:_this,__source:{fileName:_jsxFileName,lineNumber:261,columnNumber:7}},(configField==null?void 0:configField.type)===_Input2.InputFieldVariant.TextInput&&_react.default.createElement(_reactNative.TextInput,{editable:!disabled||!configField.disabledField,focusable:!disabled||!configField.disabledField,onBlur:onPressBlur,onFocus:onPressFocus,value:value,keyboardType:getKeyboardType(keyboardType),onChangeText:getOnChangeText,style:[getStyleText(),(0,_table_utils.disableOutline)(),styleField.textDefault],placeholder:placeholder,placeholderTextColor:_colors.NEUTRAL_600,maxLength:maxLength,secureTextEntry:type===_Input2.InputFieldVariant.TextInputPassword&&showPassword,onSubmitEditing:function onSubmitEditing(){return onSubmit==null?void 0:onSubmit();},__self:_this,__source:{fileName:_jsxFileName,lineNumber:272,columnNumber:11}}),(configField==null?void 0:configField.type)==='text'&&_react.default.createElement(_reactNative.Text,{numberOfLines:1,ellipsizeMode:"tail",style:[getStyleText(),(0,_table_utils.disableOutline)(),styleField.textDefault],__self:_this,__source:{fileName:_jsxFileName,lineNumber:291,columnNumber:11}},getText()),(configField==null?void 0:configField.image)&&_react.default.createElement(_reactNative.TouchableOpacity,{onPress:handlePressImage,style:_Input.styles.buttonContainerInputField,disabled:isAreaDisabled(),__self:_this,__source:{fileName:_jsxFileName,lineNumber:299,columnNumber:11}},getImage(configField.image)),_react.default.createElement(_InputOptions.default,{optionsTop:optionsTop,showOptionsAmount:showOptionsAmount,onOptionSelected:onOptionSelected,showOptions:showOptions,positionModal:positionModal,data:dataOptionsFilter,onClose:handleOnClose,onChangeFilterText:handleOnChangeFilterText,filterValue:filterValue,displayKey:displayKey,showSearchInPicker:showSearchInPicker,placeholderPickerSearch:placeholderPickerSearch,dataPicker:dataPicker,__self:_this,__source:{fileName:_jsxFileName,lineNumber:306,columnNumber:9}})));};var _default=exports.default=InputField;
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 _Input=require("../Input.style");var _Input2=require("../Input.types");var _ShowPasswordIcon=require("../../../assets/images/icons/ShowPasswordIcon");var _HidePasswordIcon=require("../../../assets/images/icons/HidePasswordIcon");var _InputOptions=_interopRequireDefault(require("./InputOptions"));var _DatePicker=_interopRequireDefault(require("../../datepicker/DatePicker"));var _colors=require("../../../styles/colors");var _table_utils=require("../../../helpers/table_utils");var _this=this,_jsxFileName="/home/jenkins/agent/workspace/etendo_ui_library_develop/etendo_ui_library/src/components/input/components/InputField.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 InputField=function InputField(_ref){var type=_ref.type,configField=_ref.configField,styleField=_ref.styleField,value=_ref.value,disabled=_ref.disabled,placeholder=_ref.placeholder,placeholderPickerSearch=_ref.placeholderPickerSearch,maxLength=_ref.maxLength,keyboardType=_ref.keyboardType,dataPicker=_ref.dataPicker,displayKey=_ref.displayKey,showSearchInPicker=_ref.showSearchInPicker,_ref$backgroundColor=_ref.backgroundColor,backgroundColor=_ref$backgroundColor===void 0?_colors.NEUTRAL_0:_ref$backgroundColor,showOptionsAmount=_ref.showOptionsAmount,_ref$height=_ref.height,height=_ref$height===void 0?40:_ref$height,onPress=_ref.onPress,onSubmit=_ref.onSubmit,onChangeText=_ref.onChangeText,onOptionSelected=_ref.onOptionSelected,onFocus=_ref.onFocus,onBlur=_ref.onBlur,language=_ref.language,dateFormat=_ref.dateFormat,showCalendar=_ref.showCalendar,isLoadingMoreData=_ref.isLoadingMoreData,onLoadMoreData=_ref.onLoadMoreData,currentPage=_ref.currentPage,isPagination=_ref.isPagination,isStopLoadMoreData=_ref.isStopLoadMoreData;var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),isFocus=_useState2[0],setIsFocus=_useState2[1];var _useState3=(0,_react.useState)(true),_useState4=(0,_slicedToArray2.default)(_useState3,2),showPassword=_useState4[0],setShowPassword=_useState4[1];var _useState5=(0,_react.useState)(false),_useState6=(0,_slicedToArray2.default)(_useState5,2),showOptions=_useState6[0],setShowOptions=_useState6[1];var _useState7=(0,_react.useState)([]),_useState8=(0,_slicedToArray2.default)(_useState7,2),dataOptionsFilter=_useState8[0],setDataOptionsFilter=_useState8[1];var _useState9=(0,_react.useState)(''),_useState10=(0,_slicedToArray2.default)(_useState9,2),filterValue=_useState10[0],setFilterValue=_useState10[1];var _useState11=(0,_react.useState)(false),_useState12=(0,_slicedToArray2.default)(_useState11,2),optionsTop=_useState12[0],setOptionsTop=_useState12[1];var _useState13=(0,_react.useState)({top:0,left:0,width:0,height:0}),_useState14=(0,_slicedToArray2.default)(_useState13,2),positionModal=_useState14[0],setPositionModal=_useState14[1];var windowHeight=_reactNative.Dimensions.get('window').height;var refComponent=(0,_react.useRef)(null);var regex=/^[0-9.,]+$/g;var getStyleText=function getStyleText(){var style=[];if(value){style.push(styleField.textDefault);}else{style.push(styleField.textPlaceholder);}return style;};(0,_react.useEffect)(function(){setDataOptionsFilter(dataPicker);if(showOptions){getTopLeft();}},[dataPicker]);var getTopLeft=function getTopLeft(){if(refComponent.current){refComponent.current.measure(function(x,y,width,height,pageX,pageY){var calcDropdownTopLeft=pageY+height+_Input.styles.spaceInOptionsAndInput.height;var showFilterHeight=showSearchInPicker?_Input.styles.optionFilterContainer.height:0;var optionsHeight=_Input.styles.optionContainer.height+_Input.styles.optionContainer.marginTop+showFilterHeight+_Input.styles.optionContainer.marginTop+_Input.styles.optionsContainer.borderWidth*2;var topPosition,bottomPosition;if(optionsHeight+calcDropdownTopLeft+_Input.styles.offSet.height>windowHeight){topPosition=pageY-optionsHeight;setOptionsTop(true);}else{topPosition=calcDropdownTopLeft;setOptionsTop(false);}bottomPosition=windowHeight-(topPosition+optionsHeight);setPositionModal({top:topPosition,bottom:bottomPosition,left:pageX,width:width,height:height});});}};var handleOnChangeFilterText=function handleOnChangeFilterText(filterText){setFilterValue(filterText||'');if(displayKey){if(isPagination&&onLoadMoreData){onLoadMoreData(0,filterText);return;}var lowerCaseFilterText=(filterText==null?void 0:filterText.toLocaleLowerCase())||'';setDataOptionsFilter(dataPicker.filter(function(item){return item[displayKey].toLocaleLowerCase().includes(lowerCaseFilterText);}));}};var handleOnClose=function handleOnClose(){setShowOptions(false);setDataOptionsFilter(dataPicker);setFilterValue('');};var getKeyboardType=function getKeyboardType(keyboardType){if(keyboardType==='number'){return'numeric';}return'default';};var getOnChangeText=function getOnChangeText(text){if(onChangeText){if(keyboardType==='number'){if(text.match(regex)||(text==null?void 0:text.length)===0){onChangeText(text);}return;}onChangeText(text);}};var getFocusStyle=function getFocusStyle(){var style=[];if(!isFocus){style.push({borderColor:'transparent'});}return style;};var removePaddingField=function removePaddingField(){var style={};if(configField!=null&&configField.image){style={paddingRight:0};}return style;};var onPressFocus=function onPressFocus(event){onFocus(event);setIsFocus(true);};var onPressBlur=function onPressBlur(event){onBlur(event);setIsFocus(false);};var getImage=function getImage(image){var fillValue=disabled?_colors.NEUTRAL_400:undefined;if(type===_Input2.InputFieldVariant.TextInputPassword){var PasswordComponent=showPassword?_HidePasswordIcon.HidePasswordIcon:_ShowPasswordIcon.ShowPasswordIcon;return _react.default.createElement(PasswordComponent,{style:_Input.styles.inputImageSize,fill:fillValue,__self:_this,__source:{fileName:_jsxFileName,lineNumber:221,columnNumber:9}});}return _react.default.cloneElement(image,{fill:fillValue});};var handlePressImage=function handlePressImage(){if(type===_Input2.InputFieldVariant.TextInputPassword){setShowPassword(function(prevState){return!prevState;});}else{onSubmit==null?void 0:onSubmit();}};var handleOnPress=function handleOnPress(event){if(type===_Input2.InputFieldVariant.Picker){getTopLeft();setShowOptions(true);}if(onPress){onPress(event);}};var getText=function getText(){if(value){return value;}return placeholder;};var isAreaDisabled=function isAreaDisabled(){return disabled||configField.disabledSubmit||!onSubmit&&type!==_Input2.InputFieldVariant.TextInputPassword;};return configField!=null&&configField.isDatePicker?_react.default.createElement(_DatePicker.default,{dateFormat:dateFormat,language:language,styleField:styleField,onChangeText:onChangeText,value:value,showCalendar:showCalendar,disabled:disabled,backgroundColor:backgroundColor,__self:_this,__source:{fileName:_jsxFileName,lineNumber:261,columnNumber:5}}):_react.default.createElement(_reactNative.View,{style:[styleField.focus,getFocusStyle()],__self:_this,__source:{fileName:_jsxFileName,lineNumber:272,columnNumber:5}},_react.default.createElement(_reactNative.TouchableOpacity,{ref:refComponent,style:[styleField.field,removePaddingField(),{backgroundColor:backgroundColor},{height:height}],disabled:disabled||configField.disabledField,onPress:handleOnPress,__self:_this,__source:{fileName:_jsxFileName,lineNumber:273,columnNumber:7}},(configField==null?void 0:configField.type)===_Input2.InputFieldVariant.TextInput&&_react.default.createElement(_reactNative.TextInput,{editable:!disabled||!configField.disabledField,focusable:!disabled||!configField.disabledField,onBlur:onPressBlur,onFocus:onPressFocus,value:value,keyboardType:getKeyboardType(keyboardType),onChangeText:getOnChangeText,style:[getStyleText(),(0,_table_utils.disableOutline)(),styleField.textDefault],placeholder:placeholder,placeholderTextColor:_colors.NEUTRAL_600,maxLength:maxLength,secureTextEntry:type===_Input2.InputFieldVariant.TextInputPassword&&showPassword,onSubmitEditing:function onSubmitEditing(){return onSubmit==null?void 0:onSubmit();},__self:_this,__source:{fileName:_jsxFileName,lineNumber:284,columnNumber:11}}),(configField==null?void 0:configField.type)==='text'&&_react.default.createElement(_reactNative.Text,{numberOfLines:1,ellipsizeMode:"tail",style:[getStyleText(),(0,_table_utils.disableOutline)(),styleField.textDefault],__self:_this,__source:{fileName:_jsxFileName,lineNumber:303,columnNumber:11}},getText()),(configField==null?void 0:configField.image)&&_react.default.createElement(_reactNative.TouchableOpacity,{onPress:handlePressImage,style:_Input.styles.buttonContainerInputField,disabled:isAreaDisabled(),__self:_this,__source:{fileName:_jsxFileName,lineNumber:311,columnNumber:11}},getImage(configField.image)),_react.default.createElement(_InputOptions.default,{optionsTop:optionsTop,showOptionsAmount:showOptionsAmount,onOptionSelected:onOptionSelected,showOptions:showOptions,positionModal:positionModal,data:dataOptionsFilter,onClose:handleOnClose,onChangeFilterText:handleOnChangeFilterText,filterValue:filterValue,displayKey:displayKey,showSearchInPicker:showSearchInPicker,placeholderPickerSearch:placeholderPickerSearch,dataPicker:dataPicker,onLoadMoreData:onLoadMoreData,isLoadingMoreData:isLoadingMoreData,currentPage:currentPage,isPagination:isPagination,isStopLoadMoreData:isStopLoadMoreData,__self:_this,__source:{fileName:_jsxFileName,lineNumber:318,columnNumber:9}})));};var _default=exports.default=InputField;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { InputOptionsProps } from '../Input.types';
3
- declare const InputOptions: ({ data, onOptionSelected, showOptions, positionModal, showOptionsAmount, onClose, filterValue, onChangeFilterText, displayKey, showSearchInPicker, placeholderPickerSearch, optionsTop, }: InputOptionsProps) => React.JSX.Element;
3
+ declare const InputOptions: ({ data, onOptionSelected, showOptions, positionModal, showOptionsAmount, onClose, filterValue, onChangeFilterText, displayKey, showSearchInPicker, placeholderPickerSearch, optionsTop, isLoadingMoreData, onLoadMoreData, currentPage, isPagination, isStopLoadMoreData, }: InputOptionsProps) => React.JSX.Element;
4
4
  export default InputOptions;
@@ -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 _reactNative=require("react-native");var _react=_interopRequireWildcard(require("react"));var _Input=require("../Input.style");var _SearchIcon=require("../../../assets/images/icons/SearchIcon");var _colors=require("../../../styles/colors");var _CancelIcon=require("../../../assets/images/icons/CancelIcon");var _table_utils=require("../../../helpers/table_utils");var _this=this,_jsxFileName="/home/jenkins/agent/workspace/etendo_ui_library_develop/etendo_ui_library/src/components/input/components/InputOptions.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 InputOptions=function InputOptions(_ref){var data=_ref.data,onOptionSelected=_ref.onOptionSelected,showOptions=_ref.showOptions,positionModal=_ref.positionModal,showOptionsAmount=_ref.showOptionsAmount,onClose=_ref.onClose,filterValue=_ref.filterValue,onChangeFilterText=_ref.onChangeFilterText,displayKey=_ref.displayKey,showSearchInPicker=_ref.showSearchInPicker,placeholderPickerSearch=_ref.placeholderPickerSearch,optionsTop=_ref.optionsTop;var _useState=(0,_react.useState)(true),_useState2=(0,_slicedToArray2.default)(_useState,2),showSearchImg=_useState2[0],setShowSearchImg=_useState2[1];var _useState3=(0,_react.useState)(true),_useState4=(0,_slicedToArray2.default)(_useState3,2),showScroll=_useState4[0],setShowScroll=_useState4[1];var _useState5=(0,_react.useState)(placeholderPickerSearch!=null?placeholderPickerSearch:''),_useState6=(0,_slicedToArray2.default)(_useState5,2),placeholderText=_useState6[0],setPlaceholderText=_useState6[1];var _useState7=(0,_react.useState)(-1),_useState8=(0,_slicedToArray2.default)(_useState7,2),indexHover=_useState8[0],setIndexHover=_useState8[1];var textInputRef=(0,_react.useRef)(null);var handleOptionSelected=function handleOptionSelected(item,index){if(onOptionSelected){onOptionSelected(item,index);}onClose();};var handleOnBlur=function handleOnBlur(){setShowSearchImg(true);if(placeholderPickerSearch){setPlaceholderText(placeholderPickerSearch);}};var handleOnFocus=function handleOnFocus(){var _textInputRef$current;setShowSearchImg(false);textInputRef==null?void 0:(_textInputRef$current=textInputRef.current)==null?void 0:_textInputRef$current.focus();setPlaceholderText('');};var handlePressOverlay=function handlePressOverlay(){onClose();if(placeholderPickerSearch){setPlaceholderText(placeholderPickerSearch);}setShowSearchImg(true);};var getBackground=function getBackground(index){if(indexHover===index){return{backgroundColor:_colors.QUATERNARY_10};}};var addRadius=function addRadius(add){if(add){return{borderBottomLeftRadius:5,borderBottomRightRadius:5};}};var removePadding=function removePadding(remove){if(!remove){return{paddingHorizontal:0};}};var addPadding=function addPadding(add){if(!add){return{paddingHorizontal:8};}};var handleCancelFilter=function handleCancelFilter(){onChangeFilterText('');};var useKeyboard=function useKeyboard(){var _useState9=(0,_react.useState)(0),_useState10=(0,_slicedToArray2.default)(_useState9,2),keyboardHeight=_useState10[0],setKeyboardHeight=_useState10[1];(0,_react.useEffect)(function(){function onKeyboardDidShow(event){setKeyboardHeight(event.endCoordinates.height);}function onKeyboardDidHide(){setKeyboardHeight(0);}var showSubscription=_reactNative.Keyboard.addListener('keyboardDidShow',onKeyboardDidShow);var hideSubscription=_reactNative.Keyboard.addListener('keyboardDidHide',onKeyboardDidHide);return function(){showSubscription.remove();hideSubscription.remove();};},[]);return keyboardHeight;};var screenHeight=_reactNative.Dimensions.get('screen').height-useKeyboard();var calculatedMaxHeight=showOptionsAmount?8+48*showOptionsAmount:screenHeight;var onContentSizeChange=function onContentSizeChange(contentWidth,contentHeight){var containerHeight=calculatedMaxHeight;setShowScroll(contentHeight>containerHeight);};(0,_react.useEffect)(function(){if(placeholderPickerSearch){setPlaceholderText(placeholderPickerSearch);}},[placeholderPickerSearch]);var keyboardHeight=useKeyboard();var bottomValue=positionModal.bottom||0;var heightValue=positionModal.height||0;var bottomDevices=function bottomDevices(){if(_reactNative.Platform.OS==='web'){return bottomValue;}else if(keyboardHeight!==0){return 0;}else{return bottomValue-heightValue*2-keyboardHeight;}};return _react.default.createElement(_reactNative.Modal,{transparent:true,visible:showOptions,animationType:"fade",__self:_this,__source:{fileName:_jsxFileName,lineNumber:158,columnNumber:5}},_react.default.createElement(_reactNative.TouchableOpacity,{style:_Input.styles.optionOverlay,onPress:handlePressOverlay,activeOpacity:1,__self:_this,__source:{fileName:_jsxFileName,lineNumber:159,columnNumber:7}}),optionsTop?_react.default.createElement(_reactNative.View,{style:[_Input.styles.optionsContainer,{width:positionModal.width,left:positionModal.left,bottom:bottomDevices(),top:keyboardHeight!==0||!showOptionsAmount?0:undefined}],__self:_this,__source:{fileName:_jsxFileName,lineNumber:165,columnNumber:9}},_react.default.createElement(_reactNative.ScrollView,{style:[showScroll&&{marginRight:8},{maxHeight:calculatedMaxHeight},_Input.styles.scrollOptions],keyboardShouldPersistTaps:"always",persistentScrollbar:true,showsVerticalScrollIndicator:true,indicatorStyle:'black',onContentSizeChange:onContentSizeChange,__self:_this,__source:{fileName:_jsxFileName,lineNumber:175,columnNumber:11}},data==null?void 0:data.map(function(item,index){return _react.default.createElement(_reactNative.Pressable,{onHoverIn:function onHoverIn(){setIndexHover(index);},onHoverOut:function onHoverOut(){setIndexHover(-1);},onPressIn:function onPressIn(){setIndexHover(index);},onPressOut:function onPressOut(){setIndexHover(-1);},key:index,style:[_Input.styles.optionContainer,0===index&&{marginTop:0},getBackground(index),addRadius(index===(data==null?void 0:data.length)-1)],onPress:function onPress(){return handleOptionSelected(item,index);},__self:_this,__source:{fileName:_jsxFileName,lineNumber:188,columnNumber:17}},displayKey&&_react.default.createElement(_reactNative.Text,{numberOfLines:1,ellipsizeMode:"tail",style:_Input.styles.optionText,__self:_this,__source:{fileName:_jsxFileName,lineNumber:210,columnNumber:21}},item[displayKey]));})),showSearchInPicker&&_react.default.createElement(_reactNative.Pressable,{onPress:handleOnFocus,style:[_Input.styles.optionTopFilterContainer,removePadding(!filterValue&&showSearchImg)],__self:_this,__source:{fileName:_jsxFileName,lineNumber:222,columnNumber:13}},filterValue===''&&showSearchImg&&_react.default.createElement(_reactNative.View,{style:_Input.styles.searchContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:229,columnNumber:17}},_react.default.createElement(_SearchIcon.SearchIcon,{style:_Input.styles.optionFilterImg,fill:_colors.NEUTRAL_600,__self:_this,__source:{fileName:_jsxFileName,lineNumber:230,columnNumber:19}})),_react.default.createElement(_reactNative.TextInput,{ref:textInputRef,onFocus:handleOnFocus,onBlur:handleOnBlur,style:[_Input.styles.optionFilterText,addPadding(!filterValue&&showSearchImg),(0,_table_utils.disableOutline)()],value:filterValue,onChangeText:onChangeFilterText,placeholder:placeholderText,placeholderTextColor:_colors.NEUTRAL_600,__self:_this,__source:{fileName:_jsxFileName,lineNumber:236,columnNumber:15}}),filterValue!==''&&_react.default.createElement(_reactNative.TouchableOpacity,{style:_Input.styles.cancelContainer,onPress:handleCancelFilter,__self:_this,__source:{fileName:_jsxFileName,lineNumber:251,columnNumber:17}},_react.default.createElement(_CancelIcon.CancelIcon,{style:_Input.styles.cancelFilterImg,__self:_this,__source:{fileName:_jsxFileName,lineNumber:254,columnNumber:19}})))):_react.default.createElement(_reactNative.View,{style:[_Input.styles.optionsContainer,{width:positionModal.width,left:positionModal.left,top:positionModal.top}],__self:_this,__source:{fileName:_jsxFileName,lineNumber:261,columnNumber:9}},showSearchInPicker&&_react.default.createElement(_reactNative.Pressable,{onPress:handleOnFocus,style:[_Input.styles.optionFilterContainer,removePadding(!filterValue&&showSearchImg)],__self:_this,__source:{fileName:_jsxFileName,lineNumber:271,columnNumber:13}},filterValue===''&&showSearchImg&&_react.default.createElement(_reactNative.View,{style:_Input.styles.searchContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:278,columnNumber:17}},_react.default.createElement(_SearchIcon.SearchIcon,{style:_Input.styles.optionFilterImg,fill:_colors.NEUTRAL_600,__self:_this,__source:{fileName:_jsxFileName,lineNumber:279,columnNumber:19}})),_react.default.createElement(_reactNative.TextInput,{ref:textInputRef,onFocus:handleOnFocus,onBlur:handleOnBlur,style:[_Input.styles.optionFilterText,addPadding(!filterValue&&showSearchImg),(0,_table_utils.disableOutline)()],value:filterValue,onChangeText:onChangeFilterText,placeholder:placeholderText,placeholderTextColor:_colors.NEUTRAL_600,__self:_this,__source:{fileName:_jsxFileName,lineNumber:285,columnNumber:15}}),filterValue!==''&&_react.default.createElement(_reactNative.TouchableOpacity,{style:_Input.styles.cancelContainer,onPress:handleCancelFilter,__self:_this,__source:{fileName:_jsxFileName,lineNumber:300,columnNumber:17}},_react.default.createElement(_CancelIcon.CancelIcon,{style:_Input.styles.cancelFilterImg,__self:_this,__source:{fileName:_jsxFileName,lineNumber:303,columnNumber:19}}))),_react.default.createElement(_reactNative.ScrollView,{style:[showScroll&&{marginRight:8},{maxHeight:calculatedMaxHeight},_Input.styles.scrollOptions],keyboardShouldPersistTaps:"always",persistentScrollbar:true,showsVerticalScrollIndicator:true,indicatorStyle:'black',onContentSizeChange:onContentSizeChange,__self:_this,__source:{fileName:_jsxFileName,lineNumber:308,columnNumber:11}},data==null?void 0:data.map(function(item,index){return _react.default.createElement(_reactNative.Pressable,{onHoverIn:function onHoverIn(){setIndexHover(index);},onHoverOut:function onHoverOut(){setIndexHover(-1);},onPressIn:function onPressIn(){setIndexHover(index);},onPressOut:function onPressOut(){setIndexHover(-1);},key:index,style:[_Input.styles.optionContainer,0===index&&{marginTop:0},getBackground(index),addRadius(index===(data==null?void 0:data.length)-1)],onPress:function onPress(){return handleOptionSelected(item,index);},__self:_this,__source:{fileName:_jsxFileName,lineNumber:321,columnNumber:17}},displayKey&&_react.default.createElement(_reactNative.Text,{numberOfLines:1,ellipsizeMode:"tail",style:_Input.styles.optionText,__self:_this,__source:{fileName:_jsxFileName,lineNumber:343,columnNumber:21}},item[displayKey]));}))));};var _default=exports.default=InputOptions;
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 _reactNative=require("react-native");var _react=_interopRequireWildcard(require("react"));var _Input=require("../Input.style");var _SearchIcon=require("../../../assets/images/icons/SearchIcon");var _colors=require("../../../styles/colors");var _CancelIcon=require("../../../assets/images/icons/CancelIcon");var _table_utils=require("../../../helpers/table_utils");var _this=this,_jsxFileName="/home/jenkins/agent/workspace/etendo_ui_library_develop/etendo_ui_library/src/components/input/components/InputOptions.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 InputOptions=function InputOptions(_ref){var data=_ref.data,onOptionSelected=_ref.onOptionSelected,showOptions=_ref.showOptions,positionModal=_ref.positionModal,showOptionsAmount=_ref.showOptionsAmount,onClose=_ref.onClose,filterValue=_ref.filterValue,onChangeFilterText=_ref.onChangeFilterText,displayKey=_ref.displayKey,showSearchInPicker=_ref.showSearchInPicker,placeholderPickerSearch=_ref.placeholderPickerSearch,optionsTop=_ref.optionsTop,isLoadingMoreData=_ref.isLoadingMoreData,onLoadMoreData=_ref.onLoadMoreData,currentPage=_ref.currentPage,isPagination=_ref.isPagination,isStopLoadMoreData=_ref.isStopLoadMoreData;var _useState=(0,_react.useState)(true),_useState2=(0,_slicedToArray2.default)(_useState,2),showSearchImg=_useState2[0],setShowSearchImg=_useState2[1];var _useState3=(0,_react.useState)(true),_useState4=(0,_slicedToArray2.default)(_useState3,2),showScroll=_useState4[0],setShowScroll=_useState4[1];var _useState5=(0,_react.useState)(0),_useState6=(0,_slicedToArray2.default)(_useState5,2),startIndex=_useState6[0],setStartIndex=_useState6[1];var _useState7=(0,_react.useState)(''),_useState8=(0,_slicedToArray2.default)(_useState7,2),filterInputValue=_useState8[0],setFilterInputValue=_useState8[1];var _useState9=(0,_react.useState)(placeholderPickerSearch!=null?placeholderPickerSearch:''),_useState10=(0,_slicedToArray2.default)(_useState9,2),placeholderText=_useState10[0],setPlaceholderText=_useState10[1];var _useState11=(0,_react.useState)(-1),_useState12=(0,_slicedToArray2.default)(_useState11,2),indexHover=_useState12[0],setIndexHover=_useState12[1];var textInputRef=(0,_react.useRef)(null);var scrollViewRef=(0,_react.useRef)(null);var handleOptionSelected=function handleOptionSelected(item,index){if(onOptionSelected){onOptionSelected(item,index);}onClose();};var handleOnBlur=function handleOnBlur(){setShowSearchImg(true);if(placeholderPickerSearch){setPlaceholderText(placeholderPickerSearch);}};var handleOnFocus=function handleOnFocus(){var _textInputRef$current;setShowSearchImg(false);textInputRef==null?void 0:(_textInputRef$current=textInputRef.current)==null?void 0:_textInputRef$current.focus();setPlaceholderText('');};var handlePressOverlay=function handlePressOverlay(){onClose();if(placeholderPickerSearch){setPlaceholderText(placeholderPickerSearch);}setShowSearchImg(true);};var getBackground=function getBackground(index){if(indexHover===index){return{backgroundColor:_colors.QUATERNARY_10};}};var addRadius=function addRadius(add){if(add){return{borderBottomLeftRadius:5,borderBottomRightRadius:5};}};var removePadding=function removePadding(remove){if(!remove){return{paddingHorizontal:0};}};var addPadding=function addPadding(add){if(!add){return{paddingHorizontal:8};}};var handleCancelFilter=function handleCancelFilter(){setFilterInputValue('');onChangeFilterText('');};var useKeyboard=function useKeyboard(){var _useState13=(0,_react.useState)(0),_useState14=(0,_slicedToArray2.default)(_useState13,2),keyboardHeight=_useState14[0],setKeyboardHeight=_useState14[1];(0,_react.useEffect)(function(){function onKeyboardDidShow(event){setKeyboardHeight(event.endCoordinates.height);}function onKeyboardDidHide(){setKeyboardHeight(0);}var showSubscription=_reactNative.Keyboard.addListener('keyboardDidShow',onKeyboardDidShow);var hideSubscription=_reactNative.Keyboard.addListener('keyboardDidHide',onKeyboardDidHide);return function(){showSubscription.remove();hideSubscription.remove();};},[]);return keyboardHeight;};var screenHeight=_reactNative.Dimensions.get('screen').height-useKeyboard();var calculatedMaxHeight=showOptionsAmount?8+48*showOptionsAmount:screenHeight;var onContentSizeChange=function onContentSizeChange(contentWidth,contentHeight){var containerHeight=calculatedMaxHeight;if(showOptionsAmount&&contentHeight>containerHeight&&data.length>showOptionsAmount){setStartIndex((startIndex+1)%data.length);}setShowScroll(contentHeight>containerHeight);};var keyboardHeight=useKeyboard();var bottomValue=positionModal.bottom||0;var heightValue=positionModal.height||0;var bottomDevices=function bottomDevices(){if(_reactNative.Platform.OS==='web'){return bottomValue;}else if(keyboardHeight!==0){return 0;}else{return bottomValue-heightValue*2-keyboardHeight;}};var loadMoreData=function loadMoreData(){if(onLoadMoreData&&!isStopLoadMoreData&&!isLoadingMoreData&&(currentPage||currentPage===0)&&isPagination){if(scrollViewRef.current)scrollViewRef.current.scrollToEnd({animated:true});onLoadMoreData(currentPage+1,filterValue);}};var debounce=function debounce(func,delay){var inDebounce;return function(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}var context=this;clearTimeout(inDebounce);inDebounce=setTimeout(function(){return func.apply(context,args);},delay);};};var debounceOnChange=(0,_react.useRef)(debounce(function(nextValue){if(scrollViewRef.current)scrollViewRef.current.scrollTo({y:0,animated:false});onChangeFilterText(nextValue);},500)).current;var onChangeText=(0,_react.useCallback)(function(text){setFilterInputValue(text);debounceOnChange(text);},[debounceOnChange]);return _react.default.createElement(_reactNative.Modal,{transparent:true,visible:showOptions,animationType:"fade",__self:_this,__source:{fileName:_jsxFileName,lineNumber:223,columnNumber:5}},_react.default.createElement(_reactNative.TouchableOpacity,{style:_Input.styles.optionOverlay,onPress:handlePressOverlay,activeOpacity:1,__self:_this,__source:{fileName:_jsxFileName,lineNumber:224,columnNumber:7}}),optionsTop?_react.default.createElement(_reactNative.View,{style:[_Input.styles.optionsContainer,{width:positionModal.width,left:positionModal.left,bottom:bottomDevices(),top:keyboardHeight!==0||!showOptionsAmount?0:undefined}],__self:_this,__source:{fileName:_jsxFileName,lineNumber:230,columnNumber:9}},_react.default.createElement(_reactNative.ScrollView,{style:[showScroll&&{marginRight:8},{maxHeight:calculatedMaxHeight},_Input.styles.scrollOptions],keyboardShouldPersistTaps:"always",persistentScrollbar:true,showsVerticalScrollIndicator:true,indicatorStyle:'black',onContentSizeChange:onContentSizeChange,__self:_this,__source:{fileName:_jsxFileName,lineNumber:240,columnNumber:11}},data==null?void 0:data.map(function(item,index){var actualIndex=(startIndex+index)%data.length;return _react.default.createElement(_reactNative.Pressable,{onHoverIn:function onHoverIn(){setIndexHover(actualIndex);},onHoverOut:function onHoverOut(){setIndexHover(-1);},onPressIn:function onPressIn(){setIndexHover(actualIndex);},onPressOut:function onPressOut(){setIndexHover(-1);},key:actualIndex,style:[_Input.styles.optionContainer,0===index&&{marginTop:0},getBackground(actualIndex),addRadius(index===(data==null?void 0:data.length)-1)],onPress:function onPress(){return handleOptionSelected(item,actualIndex);},__self:_this,__source:{fileName:_jsxFileName,lineNumber:254,columnNumber:17}},displayKey&&_react.default.createElement(_reactNative.Text,{numberOfLines:1,ellipsizeMode:"tail",style:_Input.styles.optionText,__self:_this,__source:{fileName:_jsxFileName,lineNumber:276,columnNumber:21}},item[displayKey]));})),showSearchInPicker&&_react.default.createElement(_reactNative.Pressable,{onPress:handleOnFocus,style:[_Input.styles.optionTopFilterContainer,removePadding(!filterValue&&showSearchImg)],__self:_this,__source:{fileName:_jsxFileName,lineNumber:288,columnNumber:13}},filterValue===''&&showSearchImg&&_react.default.createElement(_reactNative.View,{style:_Input.styles.searchContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:295,columnNumber:17}},_react.default.createElement(_SearchIcon.SearchIcon,{style:_Input.styles.optionFilterImg,fill:_colors.NEUTRAL_600,__self:_this,__source:{fileName:_jsxFileName,lineNumber:296,columnNumber:19}})),_react.default.createElement(_reactNative.TextInput,{ref:textInputRef,onFocus:handleOnFocus,onBlur:handleOnBlur,style:[_Input.styles.optionFilterText,addPadding(!filterValue&&showSearchImg),(0,_table_utils.disableOutline)()],value:filterValue,onChangeText:onChangeFilterText,placeholder:placeholderText,placeholderTextColor:_colors.NEUTRAL_600,__self:_this,__source:{fileName:_jsxFileName,lineNumber:302,columnNumber:15}}),filterValue!==''&&_react.default.createElement(_reactNative.TouchableOpacity,{style:_Input.styles.cancelContainer,onPress:handleCancelFilter,__self:_this,__source:{fileName:_jsxFileName,lineNumber:317,columnNumber:17}},_react.default.createElement(_CancelIcon.CancelIcon,{style:_Input.styles.cancelFilterImg,__self:_this,__source:{fileName:_jsxFileName,lineNumber:320,columnNumber:19}})))):_react.default.createElement(_reactNative.View,{style:[_Input.styles.optionsContainer,{width:positionModal.width,left:positionModal.left,top:positionModal.top}],__self:_this,__source:{fileName:_jsxFileName,lineNumber:327,columnNumber:9}},showSearchInPicker&&_react.default.createElement(_reactNative.Pressable,{onPress:handleOnFocus,style:[_Input.styles.optionFilterContainer,removePadding(!filterValue&&showSearchImg)],__self:_this,__source:{fileName:_jsxFileName,lineNumber:337,columnNumber:13}},filterInputValue===''&&showSearchImg&&_react.default.createElement(_reactNative.View,{style:_Input.styles.searchContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:344,columnNumber:17}},_react.default.createElement(_SearchIcon.SearchIcon,{style:_Input.styles.optionFilterImg,fill:_colors.NEUTRAL_600,__self:_this,__source:{fileName:_jsxFileName,lineNumber:345,columnNumber:19}})),_react.default.createElement(_reactNative.TextInput,{ref:textInputRef,onFocus:handleOnFocus,onBlur:handleOnBlur,style:[_Input.styles.optionFilterText,addPadding(!filterValue&&showSearchImg),(0,_table_utils.disableOutline)()],value:filterInputValue,onChangeText:onChangeText,placeholder:placeholderText,placeholderTextColor:_colors.NEUTRAL_600,__self:_this,__source:{fileName:_jsxFileName,lineNumber:351,columnNumber:15}}),isLoadingMoreData&&_react.default.createElement(_reactNative.TouchableOpacity,{style:{marginRight:12},onPress:handleCancelFilter,__self:_this,__source:{fileName:_jsxFileName,lineNumber:366,columnNumber:17}},_react.default.createElement(_reactNative.ActivityIndicator,{size:'small',color:_colors.PRIMARY_100,style:[_Input.styles.cancelFilterImg],__self:_this,__source:{fileName:_jsxFileName,lineNumber:369,columnNumber:19}})),filterInputValue!==''&&_react.default.createElement(_reactNative.TouchableOpacity,{style:_Input.styles.cancelContainer,onPress:handleCancelFilter,__self:_this,__source:{fileName:_jsxFileName,lineNumber:377,columnNumber:17}},_react.default.createElement(_CancelIcon.CancelIcon,{style:_Input.styles.cancelFilterImg,__self:_this,__source:{fileName:_jsxFileName,lineNumber:380,columnNumber:19}}))),_react.default.createElement(_reactNative.ScrollView,{ref:scrollViewRef,style:[showScroll&&{marginRight:8},{maxHeight:calculatedMaxHeight},_Input.styles.scrollOptions],keyboardShouldPersistTaps:"always",persistentScrollbar:true,showsVerticalScrollIndicator:true,indicatorStyle:'black',onContentSizeChange:onContentSizeChange,onScroll:function onScroll(_ref2){var nativeEvent=_ref2.nativeEvent;var isCloseToBottom=nativeEvent.layoutMeasurement.height+nativeEvent.contentOffset.y>=nativeEvent.contentSize.height-50;if(isCloseToBottom){loadMoreData();}},__self:_this,__source:{fileName:_jsxFileName,lineNumber:386,columnNumber:11}},data==null?void 0:data.map(function(item,index){return _react.default.createElement(_reactNative.Pressable,{onHoverIn:function onHoverIn(){setIndexHover(index);},onHoverOut:function onHoverOut(){setIndexHover(-1);},onPressIn:function onPressIn(){setIndexHover(index);},onPressOut:function onPressOut(){setIndexHover(-1);},key:index,style:[_Input.styles.optionContainer,0===index&&{marginTop:0},getBackground(index),addRadius(index===(data==null?void 0:data.length)-1)],onPress:function onPress(){return handleOptionSelected(item,index);},__self:_this,__source:{fileName:_jsxFileName,lineNumber:409,columnNumber:17}},displayKey&&_react.default.createElement(_reactNative.Text,{numberOfLines:1,ellipsizeMode:"tail",style:_Input.styles.optionText,__self:_this,__source:{fileName:_jsxFileName,lineNumber:431,columnNumber:21}},item[displayKey]));}),isLoadingMoreData&&_react.default.createElement(_reactNative.ActivityIndicator,{size:'large',color:_colors.PRIMARY_100,__self:_this,__source:{fileName:_jsxFileName,lineNumber:442,columnNumber:15}}))));};var _default=exports.default=InputOptions;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { InputProps } from './Input.types';
3
- declare const Input: ({ value, titleLabel, titleImage, helperText, placeholder, placeholderPickerSearch, disabled, maxLength, centerText, keyboardType, displayKey, dataPicker, backgroundColor, showOptionsAmount, showSearchInPicker, height, onPress, onSubmit, onFocus, onBlur, onChangeText, onOptionSelected, typeField, isError, language, dateFormat, showCalendar, }: InputProps) => React.JSX.Element;
3
+ declare const Input: ({ value, titleLabel, titleImage, helperText, placeholder, placeholderPickerSearch, disabled, maxLength, centerText, keyboardType, displayKey, dataPicker, backgroundColor, showOptionsAmount, showSearchInPicker, height, onPress, onSubmit, onFocus, onBlur, onChangeText, onOptionSelected, typeField, isError, language, dateFormat, showCalendar, currentPage, isLoadingMoreData, onLoadMoreData, isPagination, isStopLoadMoreData, }: InputProps) => React.JSX.Element;
4
4
  export default Input;
@@ -34,7 +34,12 @@ var Input = function Input(_ref) {
34
34
  isError = _ref.isError,
35
35
  language = _ref.language,
36
36
  dateFormat = _ref.dateFormat,
37
- showCalendar = _ref.showCalendar;
37
+ showCalendar = _ref.showCalendar,
38
+ currentPage = _ref.currentPage,
39
+ isLoadingMoreData = _ref.isLoadingMoreData,
40
+ onLoadMoreData = _ref.onLoadMoreData,
41
+ isPagination = _ref.isPagination,
42
+ isStopLoadMoreData = _ref.isStopLoadMoreData;
38
43
  var stateStyle = function stateStyle() {
39
44
  if (typeField === 'readOnly') {
40
45
  return inputStyleVariants.readOnly;
@@ -88,7 +93,12 @@ var Input = function Input(_ref) {
88
93
  height: height,
89
94
  language: language,
90
95
  dateFormat: dateFormat,
91
- showCalendar: showCalendar
96
+ showCalendar: showCalendar,
97
+ currentPage: currentPage,
98
+ onLoadMoreData: onLoadMoreData,
99
+ isLoadingMoreData: isLoadingMoreData,
100
+ isPagination: isPagination,
101
+ isStopLoadMoreData: isStopLoadMoreData
92
102
  }), /*#__PURE__*/React.createElement(InputHelperText, {
93
103
  label: helperText,
94
104
  styleHelper: stateStyle().helperStyle
@@ -68,6 +68,11 @@ export interface InputProps {
68
68
  language?: LanguageFormat;
69
69
  dateFormat?: DateFormat;
70
70
  showCalendar?: boolean;
71
+ isLoadingMoreData?: boolean;
72
+ onLoadMoreData?: (currentPage?: number, filterText?: string) => void;
73
+ currentPage?: number;
74
+ isPagination?: boolean;
75
+ isStopLoadMoreData?: boolean;
71
76
  }
72
77
  export interface InputTitleProps {
73
78
  titleLabel?: string;
@@ -112,6 +117,11 @@ export interface InputFieldProps {
112
117
  onBlur: (event?: NativeSyntheticEvent<TextInputFocusEventData>) => void;
113
118
  dateFormat?: any;
114
119
  showCalendar?: boolean;
120
+ isLoadingMoreData?: boolean;
121
+ onLoadMoreData?: (currentPage?: number, filterText?: string) => void;
122
+ currentPage?: number;
123
+ isPagination?: boolean;
124
+ isStopLoadMoreData?: boolean;
115
125
  }
116
126
  export interface InputHelperProps {
117
127
  styleHelper: TextStyle | TextStyle[];
@@ -137,4 +147,9 @@ export interface InputOptionsProps {
137
147
  placeholderPickerSearch?: string;
138
148
  optionsTop: boolean;
139
149
  dataPicker: any;
150
+ isLoadingMoreData?: boolean;
151
+ onLoadMoreData?: (currentPage?: number, filterText?: string) => void;
152
+ currentPage?: number;
153
+ isPagination?: boolean;
154
+ isStopLoadMoreData?: boolean;
140
155
  }
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { InputFieldProps } from '../Input.types';
3
- declare const InputField: ({ type, configField, styleField, value, disabled, placeholder, placeholderPickerSearch, maxLength, keyboardType, dataPicker, displayKey, showSearchInPicker, backgroundColor, showOptionsAmount, height, onPress, onSubmit, onChangeText, onOptionSelected, onFocus, onBlur, language, dateFormat, showCalendar, }: InputFieldProps) => React.JSX.Element;
3
+ declare const InputField: ({ type, configField, styleField, value, disabled, placeholder, placeholderPickerSearch, maxLength, keyboardType, dataPicker, displayKey, showSearchInPicker, backgroundColor, showOptionsAmount, height, onPress, onSubmit, onChangeText, onOptionSelected, onFocus, onBlur, language, dateFormat, showCalendar, isLoadingMoreData, onLoadMoreData, currentPage, isPagination, isStopLoadMoreData, }: InputFieldProps) => React.JSX.Element;
4
4
  export default InputField;
@@ -40,7 +40,12 @@ var InputField = function InputField(_ref) {
40
40
  onBlur = _ref.onBlur,
41
41
  language = _ref.language,
42
42
  dateFormat = _ref.dateFormat,
43
- showCalendar = _ref.showCalendar;
43
+ showCalendar = _ref.showCalendar,
44
+ isLoadingMoreData = _ref.isLoadingMoreData,
45
+ onLoadMoreData = _ref.onLoadMoreData,
46
+ currentPage = _ref.currentPage,
47
+ isPagination = _ref.isPagination,
48
+ isStopLoadMoreData = _ref.isStopLoadMoreData;
44
49
  var _useState = useState(false),
45
50
  _useState2 = _slicedToArray(_useState, 2),
46
51
  isFocus = _useState2[0],
@@ -118,10 +123,17 @@ var InputField = function InputField(_ref) {
118
123
  }
119
124
  };
120
125
  var handleOnChangeFilterText = function handleOnChangeFilterText(filterText) {
121
- setFilterValue(filterText);
122
- if (displayKey) setDataOptionsFilter(dataPicker.filter(function (item) {
123
- return item[displayKey].toLocaleLowerCase().includes(filterText.toLocaleLowerCase());
124
- }));
126
+ setFilterValue(filterText || '');
127
+ if (displayKey) {
128
+ if (isPagination && onLoadMoreData) {
129
+ onLoadMoreData(0, filterText);
130
+ return;
131
+ }
132
+ var lowerCaseFilterText = (filterText === null || filterText === void 0 ? void 0 : filterText.toLocaleLowerCase()) || '';
133
+ setDataOptionsFilter(dataPicker.filter(function (item) {
134
+ return item[displayKey].toLocaleLowerCase().includes(lowerCaseFilterText);
135
+ }));
136
+ }
125
137
  };
126
138
  var handleOnClose = function handleOnClose() {
127
139
  setShowOptions(false);
@@ -268,7 +280,12 @@ var InputField = function InputField(_ref) {
268
280
  displayKey: displayKey,
269
281
  showSearchInPicker: showSearchInPicker,
270
282
  placeholderPickerSearch: placeholderPickerSearch,
271
- dataPicker: dataPicker
283
+ dataPicker: dataPicker,
284
+ onLoadMoreData: onLoadMoreData,
285
+ isLoadingMoreData: isLoadingMoreData,
286
+ currentPage: currentPage,
287
+ isPagination: isPagination,
288
+ isStopLoadMoreData: isStopLoadMoreData
272
289
  })));
273
290
  };
274
291
  export default InputField;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { InputOptionsProps } from '../Input.types';
3
- declare const InputOptions: ({ data, onOptionSelected, showOptions, positionModal, showOptionsAmount, onClose, filterValue, onChangeFilterText, displayKey, showSearchInPicker, placeholderPickerSearch, optionsTop, }: InputOptionsProps) => React.JSX.Element;
3
+ declare const InputOptions: ({ data, onOptionSelected, showOptions, positionModal, showOptionsAmount, onClose, filterValue, onChangeFilterText, displayKey, showSearchInPicker, placeholderPickerSearch, optionsTop, isLoadingMoreData, onLoadMoreData, currentPage, isPagination, isStopLoadMoreData, }: InputOptionsProps) => React.JSX.Element;
4
4
  export default InputOptions;
@@ -4,11 +4,11 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
4
4
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
5
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import { Modal, Pressable, ScrollView, Text, TextInput, TouchableOpacity, View, Platform, Keyboard, Dimensions } from "react-native-web";
8
- import React, { useEffect, useRef, useState } from 'react';
7
+ import { Modal, Pressable, ScrollView, Text, TextInput, TouchableOpacity, View, Platform, Keyboard, Dimensions, ActivityIndicator } from "react-native-web";
8
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
9
9
  import { styles } from "../Input.style";
10
10
  import { SearchIcon } from "../../../assets/images/icons/SearchIcon";
11
- import { NEUTRAL_600, QUATERNARY_10 } from "../../../styles/colors";
11
+ import { NEUTRAL_600, PRIMARY_100, QUATERNARY_10 } from "../../../styles/colors";
12
12
  import { CancelIcon } from "../../../assets/images/icons/CancelIcon";
13
13
  import { disableOutline } from "../../../helpers/table_utils";
14
14
  var InputOptions = function InputOptions(_ref) {
@@ -23,7 +23,12 @@ var InputOptions = function InputOptions(_ref) {
23
23
  displayKey = _ref.displayKey,
24
24
  showSearchInPicker = _ref.showSearchInPicker,
25
25
  placeholderPickerSearch = _ref.placeholderPickerSearch,
26
- optionsTop = _ref.optionsTop;
26
+ optionsTop = _ref.optionsTop,
27
+ isLoadingMoreData = _ref.isLoadingMoreData,
28
+ onLoadMoreData = _ref.onLoadMoreData,
29
+ currentPage = _ref.currentPage,
30
+ isPagination = _ref.isPagination,
31
+ isStopLoadMoreData = _ref.isStopLoadMoreData;
27
32
  var _useState = useState(true),
28
33
  _useState2 = _slicedToArray(_useState, 2),
29
34
  showSearchImg = _useState2[0],
@@ -32,15 +37,24 @@ var InputOptions = function InputOptions(_ref) {
32
37
  _useState4 = _slicedToArray(_useState3, 2),
33
38
  showScroll = _useState4[0],
34
39
  setShowScroll = _useState4[1];
35
- var _useState5 = useState(placeholderPickerSearch !== null && placeholderPickerSearch !== void 0 ? placeholderPickerSearch : ''),
40
+ var _useState5 = useState(0),
36
41
  _useState6 = _slicedToArray(_useState5, 2),
37
- placeholderText = _useState6[0],
38
- setPlaceholderText = _useState6[1];
39
- var _useState7 = useState(-1),
42
+ startIndex = _useState6[0],
43
+ setStartIndex = _useState6[1];
44
+ var _useState7 = useState(''),
40
45
  _useState8 = _slicedToArray(_useState7, 2),
41
- indexHover = _useState8[0],
42
- setIndexHover = _useState8[1];
46
+ filterInputValue = _useState8[0],
47
+ setFilterInputValue = _useState8[1];
48
+ var _useState9 = useState(placeholderPickerSearch !== null && placeholderPickerSearch !== void 0 ? placeholderPickerSearch : ''),
49
+ _useState10 = _slicedToArray(_useState9, 2),
50
+ placeholderText = _useState10[0],
51
+ setPlaceholderText = _useState10[1];
52
+ var _useState11 = useState(-1),
53
+ _useState12 = _slicedToArray(_useState11, 2),
54
+ indexHover = _useState12[0],
55
+ setIndexHover = _useState12[1];
43
56
  var textInputRef = useRef(null);
57
+ var scrollViewRef = useRef(null);
44
58
  var handleOptionSelected = function handleOptionSelected(item, index) {
45
59
  if (onOptionSelected) {
46
60
  onOptionSelected(item, index);
@@ -96,13 +110,14 @@ var InputOptions = function InputOptions(_ref) {
96
110
  }
97
111
  };
98
112
  var handleCancelFilter = function handleCancelFilter() {
113
+ setFilterInputValue('');
99
114
  onChangeFilterText('');
100
115
  };
101
116
  var useKeyboard = function useKeyboard() {
102
- var _useState9 = useState(0),
103
- _useState10 = _slicedToArray(_useState9, 2),
104
- keyboardHeight = _useState10[0],
105
- setKeyboardHeight = _useState10[1];
117
+ var _useState13 = useState(0),
118
+ _useState14 = _slicedToArray(_useState13, 2),
119
+ keyboardHeight = _useState14[0],
120
+ setKeyboardHeight = _useState14[1];
106
121
  useEffect(function () {
107
122
  function onKeyboardDidShow(event) {
108
123
  setKeyboardHeight(event.endCoordinates.height);
@@ -123,13 +138,11 @@ var InputOptions = function InputOptions(_ref) {
123
138
  var calculatedMaxHeight = showOptionsAmount ? 8 + 48 * showOptionsAmount : screenHeight;
124
139
  var onContentSizeChange = function onContentSizeChange(contentWidth, contentHeight) {
125
140
  var containerHeight = calculatedMaxHeight;
141
+ if (showOptionsAmount && contentHeight > containerHeight && data.length > showOptionsAmount) {
142
+ setStartIndex((startIndex + 1) % data.length);
143
+ }
126
144
  setShowScroll(contentHeight > containerHeight);
127
145
  };
128
- useEffect(function () {
129
- if (placeholderPickerSearch) {
130
- setPlaceholderText(placeholderPickerSearch);
131
- }
132
- }, [placeholderPickerSearch]);
133
146
  var keyboardHeight = useKeyboard();
134
147
  var bottomValue = positionModal.bottom || 0;
135
148
  var heightValue = positionModal.height || 0;
@@ -142,6 +155,38 @@ var InputOptions = function InputOptions(_ref) {
142
155
  return bottomValue - heightValue * 2 - keyboardHeight;
143
156
  }
144
157
  };
158
+ var loadMoreData = function loadMoreData() {
159
+ if (onLoadMoreData && !isStopLoadMoreData && !isLoadingMoreData && (currentPage || currentPage === 0) && isPagination) {
160
+ if (scrollViewRef.current) scrollViewRef.current.scrollToEnd({
161
+ animated: true
162
+ });
163
+ onLoadMoreData(currentPage + 1, filterValue);
164
+ }
165
+ };
166
+ var debounce = function debounce(func, delay) {
167
+ var inDebounce;
168
+ return function () {
169
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
170
+ args[_key] = arguments[_key];
171
+ }
172
+ var context = this;
173
+ clearTimeout(inDebounce);
174
+ inDebounce = setTimeout(function () {
175
+ return func.apply(context, args);
176
+ }, delay);
177
+ };
178
+ };
179
+ var debounceOnChange = useRef(debounce(function (nextValue) {
180
+ if (scrollViewRef.current) scrollViewRef.current.scrollTo({
181
+ y: 0,
182
+ animated: false
183
+ });
184
+ onChangeFilterText(nextValue);
185
+ }, 500)).current;
186
+ var onChangeText = useCallback(function (text) {
187
+ setFilterInputValue(text);
188
+ debounceOnChange(text);
189
+ }, [debounceOnChange]);
145
190
  return /*#__PURE__*/React.createElement(Modal, {
146
191
  transparent: true,
147
192
  visible: showOptions,
@@ -169,25 +214,26 @@ var InputOptions = function InputOptions(_ref) {
169
214
  indicatorStyle: 'black',
170
215
  onContentSizeChange: onContentSizeChange
171
216
  }, data === null || data === void 0 ? void 0 : data.map(function (item, index) {
217
+ var actualIndex = (startIndex + index) % data.length;
172
218
  return /*#__PURE__*/React.createElement(Pressable, {
173
219
  onHoverIn: function onHoverIn() {
174
- setIndexHover(index);
220
+ setIndexHover(actualIndex);
175
221
  },
176
222
  onHoverOut: function onHoverOut() {
177
223
  setIndexHover(-1);
178
224
  },
179
225
  onPressIn: function onPressIn() {
180
- setIndexHover(index);
226
+ setIndexHover(actualIndex);
181
227
  },
182
228
  onPressOut: function onPressOut() {
183
229
  setIndexHover(-1);
184
230
  },
185
- key: index,
231
+ key: actualIndex,
186
232
  style: [styles.optionContainer, 0 === index && {
187
233
  marginTop: 0
188
- }, getBackground(index), addRadius(index === (data === null || data === void 0 ? void 0 : data.length) - 1)],
234
+ }, getBackground(actualIndex), addRadius(index === (data === null || data === void 0 ? void 0 : data.length) - 1)],
189
235
  onPress: function onPress() {
190
- return handleOptionSelected(item, index);
236
+ return handleOptionSelected(item, actualIndex);
191
237
  }
192
238
  }, displayKey && /*#__PURE__*/React.createElement(Text, {
193
239
  numberOfLines: 1,
@@ -225,7 +271,7 @@ var InputOptions = function InputOptions(_ref) {
225
271
  }, showSearchInPicker && /*#__PURE__*/React.createElement(Pressable, {
226
272
  onPress: handleOnFocus,
227
273
  style: [styles.optionFilterContainer, removePadding(!filterValue && showSearchImg)]
228
- }, filterValue === '' && showSearchImg && /*#__PURE__*/React.createElement(View, {
274
+ }, filterInputValue === '' && showSearchImg && /*#__PURE__*/React.createElement(View, {
229
275
  style: styles.searchContainer
230
276
  }, /*#__PURE__*/React.createElement(SearchIcon, {
231
277
  style: styles.optionFilterImg,
@@ -235,16 +281,26 @@ var InputOptions = function InputOptions(_ref) {
235
281
  onFocus: handleOnFocus,
236
282
  onBlur: handleOnBlur,
237
283
  style: [styles.optionFilterText, addPadding(!filterValue && showSearchImg), disableOutline()],
238
- value: filterValue,
239
- onChangeText: onChangeFilterText,
284
+ value: filterInputValue,
285
+ onChangeText: onChangeText,
240
286
  placeholder: placeholderText,
241
287
  placeholderTextColor: NEUTRAL_600
242
- }), filterValue !== '' && /*#__PURE__*/React.createElement(TouchableOpacity, {
288
+ }), isLoadingMoreData && /*#__PURE__*/React.createElement(TouchableOpacity, {
289
+ style: {
290
+ marginRight: 12
291
+ },
292
+ onPress: handleCancelFilter
293
+ }, /*#__PURE__*/React.createElement(ActivityIndicator, {
294
+ size: 'small',
295
+ color: PRIMARY_100,
296
+ style: [styles.cancelFilterImg]
297
+ })), filterInputValue !== '' && /*#__PURE__*/React.createElement(TouchableOpacity, {
243
298
  style: styles.cancelContainer,
244
299
  onPress: handleCancelFilter
245
300
  }, /*#__PURE__*/React.createElement(CancelIcon, {
246
301
  style: styles.cancelFilterImg
247
302
  }))), /*#__PURE__*/React.createElement(ScrollView, {
303
+ ref: scrollViewRef,
248
304
  style: [showScroll && {
249
305
  marginRight: 8
250
306
  }, {
@@ -254,7 +310,14 @@ var InputOptions = function InputOptions(_ref) {
254
310
  persistentScrollbar: true,
255
311
  showsVerticalScrollIndicator: true,
256
312
  indicatorStyle: 'black',
257
- onContentSizeChange: onContentSizeChange
313
+ onContentSizeChange: onContentSizeChange,
314
+ onScroll: function onScroll(_ref2) {
315
+ var nativeEvent = _ref2.nativeEvent;
316
+ var isCloseToBottom = nativeEvent.layoutMeasurement.height + nativeEvent.contentOffset.y >= nativeEvent.contentSize.height - 50;
317
+ if (isCloseToBottom) {
318
+ loadMoreData();
319
+ }
320
+ }
258
321
  }, data === null || data === void 0 ? void 0 : data.map(function (item, index) {
259
322
  return /*#__PURE__*/React.createElement(Pressable, {
260
323
  onHoverIn: function onHoverIn() {
@@ -281,6 +344,9 @@ var InputOptions = function InputOptions(_ref) {
281
344
  ellipsizeMode: "tail",
282
345
  style: styles.optionText
283
346
  }, item[displayKey]));
347
+ }), isLoadingMoreData && /*#__PURE__*/React.createElement(ActivityIndicator, {
348
+ size: 'large',
349
+ color: PRIMARY_100
284
350
  }))));
285
351
  };
286
352
  export default InputOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "etendo-ui-library",
3
- "version": "1.3.81",
3
+ "version": "1.3.82",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "android": "react-native run-android",