@jescon-technologies/react-native-ui-kit 0.0.6 → 0.0.8

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.
Files changed (191) hide show
  1. package/index.d.ts +2 -66
  2. package/index.js +1 -66
  3. package/package.json +1 -1
  4. package/src/Alerts/AAlert.js +0 -137
  5. package/src/Alerts/AAlertIOS.js +0 -97
  6. package/src/Alerts/ABlink.js +0 -40
  7. package/src/Common/Icons.js +0 -49
  8. package/src/Common/NetworkServiceCall.js +0 -265
  9. package/src/CommonStyle/CommonTheme.js +0 -11
  10. package/src/CommonStyle/ComponentFunctions.js +0 -632
  11. package/src/CommonStyle/PopupStyle.js +0 -146
  12. package/src/CommonStyle/commonStyle.js +0 -93
  13. package/src/CommonStyle/componentStyle.js +0 -545
  14. package/src/CommonStyle/optionListStyles.js +0 -175
  15. package/src/Components/ByProductPage.js +0 -200
  16. package/src/Components/CDropDownListNew.js +0 -153
  17. package/src/Components/CSupplierList.js +0 -88
  18. package/src/Components/CVerificationCard.js +0 -2822
  19. package/src/Components/CustomButton.js +0 -67
  20. package/src/Components/CustomCard.js +0 -127
  21. package/src/Components/CustomTextInput.js +0 -47
  22. package/src/Components/EquipmentPage.js +0 -313
  23. package/src/Components/FilterInput.Copy.js +0 -723
  24. package/src/Components/FilterInput.js +0 -569
  25. package/src/Components/HSubHeading.js +0 -68
  26. package/src/Components/HeaderCard.js +0 -40
  27. package/src/Components/MoreOptionsScreen.js +0 -251
  28. package/src/Components/NonSwipableProductCard.js +0 -226
  29. package/src/Components/NonSwipableSupplierCard.js +0 -348
  30. package/src/Components/ProductCard.js +0 -1336
  31. package/src/Components/QualityProductCard.js +0 -1059
  32. package/src/Components/RateProductCard.js +0 -1452
  33. package/src/Components/RawMaterial.js +0 -261
  34. package/src/Components/SDropDownEdited.js +0 -549
  35. package/src/Components/SDropDownNew.js +0 -529
  36. package/src/Components/SHelpDescription.js +0 -147
  37. package/src/Components/STextInputNew.js +0 -510
  38. package/src/Components/SearchProductCard.js +0 -470
  39. package/src/Components/StageByProduct.js +0 -199
  40. package/src/Components/SupplierCard.js +0 -243
  41. package/src/Components/SupplierInvoiceCard.js +0 -405
  42. package/src/Components/SwipableSupplierCard.js +0 -136
  43. package/src/Components/TagTemplate.js +0 -74
  44. package/src/Components/WrappedComponent.js +0 -25
  45. package/src/Custom/CBooking.js +0 -944
  46. package/src/Custom/CBookingPostpone.js +0 -1822
  47. package/src/Custom/CCalendar.js +0 -560
  48. package/src/Custom/CCard.js +0 -880
  49. package/src/Custom/CDetailCard.js +0 -205
  50. package/src/Custom/CHelpImage.js +0 -52
  51. package/src/Custom/CReport.js +0 -569
  52. package/src/Custom/CScrollView.js +0 -73
  53. package/src/Custom/CSignature.js +0 -112
  54. package/src/Custom/CSliderMenu.js +0 -339
  55. package/src/Custom/CSupplierCard.js +0 -99
  56. package/src/Custom/CTemplateCard.js +0 -438
  57. package/src/Custom/CTokenAllocation.js +0 -1402
  58. package/src/Custom/CTokenListOverlay.js +0 -122
  59. package/src/Custom/CWardStatus.js +0 -444
  60. package/src/Custom/Charts/CBarChart.js +0 -218
  61. package/src/Custom/Charts/CDashBoardList.js +0 -133
  62. package/src/Custom/Charts/CDashBoardTable.js +0 -172
  63. package/src/Custom/Charts/CLineChart.js +0 -193
  64. package/src/Custom/Charts/CPieChart.js +0 -186
  65. package/src/Custom/Loader.js +0 -182
  66. package/src/Custom/OUserView.js +0 -1121
  67. package/src/Custom/PreviewDosage.js +0 -115
  68. package/src/Custom/SearchLoader.js +0 -32
  69. package/src/Custom/TableComponent/CActivityTable.js +0 -707
  70. package/src/Custom/TableComponent/CMoreButtonTable.js +0 -197
  71. package/src/Custom/TableComponent/CTable.js +0 -185
  72. package/src/Custom/TableComponent/CTextBody.js +0 -40
  73. package/src/Custom/TableComponent/CTextHeader.js +0 -17
  74. package/src/Custom/TableComponent/PreviewPrescriptionNew.js +0 -1011
  75. package/src/Custom/TableComponent/SDropdownTable.js +0 -491
  76. package/src/Custom/TableComponent/TagTable.js +0 -1200
  77. package/src/CustomComponents/CAddColumn.js +0 -140
  78. package/src/CustomComponents/CAssessmentDelete.js +0 -307
  79. package/src/CustomComponents/CAwesomeButton.js +0 -83
  80. package/src/CustomComponents/CAwesomeMoreButton.js +0 -54
  81. package/src/CustomComponents/CBackHandler.js +0 -273
  82. package/src/CustomComponents/CCalendar.js +0 -243
  83. package/src/CustomComponents/CCommentOverlay.js +0 -202
  84. package/src/CustomComponents/CComments.js +0 -162
  85. package/src/CustomComponents/CContainerView.js +0 -24
  86. package/src/CustomComponents/CCustomTextInput.js +0 -336
  87. package/src/CustomComponents/CDetailView.js +0 -40
  88. package/src/CustomComponents/CDropDownList.js +0 -153
  89. package/src/CustomComponents/CDropdownSelect.js +0 -555
  90. package/src/CustomComponents/CFooterView.js +0 -42
  91. package/src/CustomComponents/CImagePickerSave.js +0 -316
  92. package/src/CustomComponents/CModalOverlay.js +0 -91
  93. package/src/CustomComponents/CNetworkStatus.js +0 -327
  94. package/src/CustomComponents/CNotesInstructions.js +0 -1000
  95. package/src/CustomComponents/COverlay.js +0 -81
  96. package/src/CustomComponents/CRemarks.js +0 -176
  97. package/src/CustomComponents/CRowAdd.js +0 -143
  98. package/src/CustomComponents/CSummaryDropDown.js +0 -327
  99. package/src/CustomComponents/CText.js +0 -9
  100. package/src/CustomComponents/CVectorIcon.js +0 -34
  101. package/src/CustomComponents/HtmlContentViewer.js +0 -65
  102. package/src/CustomComponents/PdfContentViewer.js +0 -90
  103. package/src/CustomComponents/SDropDownDosage.js +0 -1087
  104. package/src/CustomComponents/SwipableProductCard.js +0 -246
  105. package/src/CustomComponents/SwipableProductImageCard.js +0 -254
  106. package/src/CustomComponents/WorkOrderDetails.js +0 -1216
  107. package/src/CustomComponents/WorkOrderDetailsPage.js +0 -1213
  108. package/src/HOC/ConfirmOverlay.js +0 -192
  109. package/src/HOC/HHeading.js +0 -70
  110. package/src/HOC/HMoreButton.js +0 -88
  111. package/src/HOC/HNatureHeading.js +0 -402
  112. package/src/HOC/HOCIcons.js +0 -80
  113. package/src/HOC/HOverlayCentered.js +0 -140
  114. package/src/HOC/HShadowButton.js +0 -45
  115. package/src/HOC/HShadowCountButton.js +0 -82
  116. package/src/HOC/OptionOverlay.js +0 -48
  117. package/src/Json/Chart.json +0 -818
  118. package/src/Json/Consultation.json +0 -622
  119. package/src/Json/CreditBill.json +0 -490
  120. package/src/Json/Dropdown.json +0 -216
  121. package/src/Json/DropdownConsultation.json +0 -228
  122. package/src/Json/DynamicReports.json +0 -623
  123. package/src/Json/Footer.json +0 -79
  124. package/src/Media/AudioScreen.js +0 -342
  125. package/src/Media/BarcodeScan.js +0 -145
  126. package/src/Media/CAudioPlay.js +0 -228
  127. package/src/Media/CCaptureImageWithoutEdit.js +0 -330
  128. package/src/Media/CImageGallery.js +0 -289
  129. package/src/Media/CImageZoom.js +0 -82
  130. package/src/Media/CSingleImage.js +0 -391
  131. package/src/Media/CSketchCanvas.js +0 -76
  132. package/src/Media/CVideoPlay.js +0 -31
  133. package/src/Media/DocumentScreen.js +0 -362
  134. package/src/Media/DrawingScreen.js +0 -578
  135. package/src/Media/ImageScreen.js +0 -309
  136. package/src/Media/RecordAudio.js +0 -250
  137. package/src/Media/RecordVideo.js +0 -223
  138. package/src/Media/VideoScreen.js +0 -378
  139. package/src/Navigation/PageNavigation.js +0 -224
  140. package/src/Navigation/useFocusEffect.js +0 -2
  141. package/src/Navigation/useFocusEffect.native.js +0 -1
  142. package/src/Navigation/useFocusEffect.web.js +0 -1
  143. package/src/Navigation/useIsFocused.js +0 -1
  144. package/src/Navigation/useIsFocused.native.js +0 -1
  145. package/src/Navigation/useIsFocused.web.js +0 -1
  146. package/src/Navigation/useNavigation.js +0 -2
  147. package/src/Navigation/useNavigation.native.js +0 -1
  148. package/src/Navigation/useNavigation.web.js +0 -1
  149. package/src/Screens/CMedications.js +0 -528
  150. package/src/Screens/CWebViewGallery.js +0 -203
  151. package/src/Screens/ChartScan.js +0 -279
  152. package/src/Screens/ChartScreenNew.js +0 -1579
  153. package/src/Screens/Consultation.js +0 -1500
  154. package/src/Screens/Dashboard.js +0 -778
  155. package/src/Screens/FileExplorer.js +0 -288
  156. package/src/Screens/Footer.js +0 -340
  157. package/src/Screens/ForgotPassword.js +0 -288
  158. package/src/Screens/HeaderBlock.js +0 -353
  159. package/src/Screens/Login.js +0 -328
  160. package/src/Screens/Notification.js +0 -149
  161. package/src/Screens/OcrScreen.js +0 -20
  162. package/src/Screens/PdfPreview.js +0 -507
  163. package/src/Screens/RegistrationDetails.js +0 -467
  164. package/src/Screens/SearchScreen.js +0 -582
  165. package/src/Screens/Splash.js +0 -788
  166. package/src/Screens/SwipeLeftView.js +0 -1867
  167. package/src/StaticComponents/SAlphabet.js +0 -47
  168. package/src/StaticComponents/SCheckBox.js +0 -42
  169. package/src/StaticComponents/SDatePicker.js +0 -208
  170. package/src/StaticComponents/SDatePickerLabel.js +0 -253
  171. package/src/StaticComponents/SDatePickerNew.js +0 -258
  172. package/src/StaticComponents/SDateTimePickerNew.js +0 -381
  173. package/src/StaticComponents/SDropDownGenerate.js +0 -450
  174. package/src/StaticComponents/SDropDownHoc.js +0 -636
  175. package/src/StaticComponents/SDropDownIcon.js +0 -500
  176. package/src/StaticComponents/SMenuBox.js +0 -131
  177. package/src/StaticComponents/SOverlay.js +0 -177
  178. package/src/StaticComponents/SOverlayTextInput.js +0 -109
  179. package/src/StaticComponents/SSearch.js +0 -438
  180. package/src/StaticComponents/SSearchBar.js +0 -53
  181. package/src/StaticComponents/SSpeedDial.js +0 -303
  182. package/src/StaticComponents/STextInput.js +0 -289
  183. package/src/StaticComponents/STextInputProps.js +0 -36
  184. package/src/StaticComponents/STimePicker.js +0 -171
  185. package/src/StaticComponents/STimingDropDownNew.js +0 -1585
  186. package/src/StaticComponents/STimingSwitch.js +0 -34
  187. package/src/layout/CContainerView.js +0 -21
  188. package/src/layout/CDetailView.js +0 -81
  189. package/src/layout/HeaderBlock.js +0 -353
  190. package/src/layout/INVLoginLayout.js +0 -657
  191. package/src/layout/Loader.js +0 -176
@@ -1,510 +0,0 @@
1
- import React, {useEffect, useRef, useState} from 'react';
2
- import {
3
- View,
4
- TextInput,
5
- Dimensions,
6
- TouchableOpacity,
7
- Text,
8
- } from 'react-native';
9
- import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
10
- import {height, normalize} from '../CommonStyle/componentStyle';
11
- import CText from '../CustomComponents/CText';
12
- import {MaterialCommunityIcons} from '../Common/Icons';
13
- // import { Text } from 'react-native-animatable';
14
- import SHelpDescription from './SHelpDescription';
15
- import {Global} from '../../../../../src/Common/Global';
16
- import {Menu, MenuOptions, MenuTrigger} from 'react-native-popup-menu';
17
- import FontAwesome5Icon from 'react-native-vector-icons/FontAwesome5';
18
-
19
- const STextInputNew = props => {
20
- const [text, setText] = useState('');
21
- const [colorBg, setColorBg] = useState(false);
22
- const dynamicMenuRef = useRef(null);
23
- const inputRef = useRef(null);
24
- // const [menuVisible, setMenuVisible] = useState(false);
25
- // const [menuPosition, setMenuPosition] = useState({ top: 0, left: 0 });
26
- const data =
27
- props.data != undefined
28
- ? props.data
29
- : {
30
- itemwidth: '100%',
31
- displaytext: 'Name',
32
- iconname: 'home',
33
- value: 45,
34
- type: 'number-pad',
35
- editable: true,
36
- placeholder: 'Name',
37
- decimal: 2,
38
- };
39
-
40
- const validateEmail = email => {
41
- console.log('EMAIL validation------------------');
42
- // Regular expression for basic email validation
43
- const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
44
- console.log('EMAIL validation------------------', emailRegex.test(email));
45
- return emailRegex.test(email);
46
- };
47
-
48
- const validateMobileNumber = number => {
49
- // Regular expression for a 10-digit mobile number
50
- const mobileRegex = /^\d{10}$/;
51
- return mobileRegex.test(number);
52
- };
53
-
54
- // useEffect(() => {
55
- // setData(props.data != undefined ? props.data : {
56
- // itemwidth: "100%",
57
- // displaytext: "Name",
58
- // iconname: 'home',
59
- // value: 45,
60
- // type: 'number-pad',
61
- // editable: true,
62
- // placeholder: "Name",
63
- // decimal: 2
64
- // })
65
- // }, [props])
66
-
67
- const handleIconPress = () => {
68
- if (inputRef.current) {
69
- inputRef.current.measure((fx, fy, width, height, px, py) => {
70
- setMenuPosition({top: py + height, left: px});
71
- setMenuVisible(!menuVisible); // Toggle menu visibility
72
- });
73
- }
74
- };
75
-
76
- // let widthValue;
77
-
78
- // if (data.itemwidth !== undefined) {
79
- // // Check if it's a percentage
80
- // if (typeof data.itemwidth === 'string' && data.itemwidth.endsWith('%')) {
81
- // const numericValue = parseFloat(data.itemwidth); // Extract numeric part
82
- // widthValue = `${numericValue + 4}%`; // Append your value
83
- // } else {
84
- // // Otherwise treat it as a number (pixels)
85
- // widthValue = `${parseFloat(data.itemwidth) + 4}px`; // or use 'px' if you want pixels
86
- // }
87
- // } else {
88
- // widthValue = '100%';
89
- // }
90
-
91
- return (
92
- <View
93
- style={{
94
- borderWidth: 0,
95
- width: data.itemwidth != undefined ? data.itemwidth : '100%',
96
- }}>
97
- {/* <View style={{}}> */}
98
- {data.displaytext != undefined ? (
99
- <CText
100
- style={{
101
- fontSize: normalize(11),
102
- color: 'black',
103
- paddingHorizontal: normalize(5),
104
- borderWidth: 0,
105
- height: normalize(15),
106
- }}>
107
- {data.required == true ? (
108
- <Text
109
- style={{
110
- color: 'red',
111
- fontSize: normalize(13),
112
- fontWeight: 'bold',
113
- }}>
114
- *{' '}
115
- </Text>
116
- ) : null}
117
- {data.displaytext != undefined ? data.displaytext : 'Default'}
118
- </CText>
119
- ) : null}
120
-
121
- {/* <View style={{ flexDirection: 'row' }}> */}
122
- <View
123
- style={{
124
- flexDirection: 'row',
125
- borderWidth: 1,
126
- borderRadius: data.borderRadius != undefined ? data.borderRadius : 5,
127
- alignItems: 'center',
128
- backgroundColor: data.backgroundColor ? data.backgroundColor : '#fff',
129
- elevation: 0,
130
- borderColor: colorBg ? 'darkblue' : 'lightgrey',
131
- }}>
132
- {data.iconname != undefined || data.iconName != undefined ? (
133
- <Menu ref={dynamicMenuRef}>
134
- <MenuTrigger
135
- disabled={false}
136
- customStyles={{
137
- triggerWrapper: {
138
- borderWidth: 0,
139
- borderRadius: 10,
140
- elevation: 0,
141
- },
142
- }}>
143
- <TouchableOpacity
144
- disabled={true}
145
- style={{width: normalize(22), paddingLeft: normalize(3)}}>
146
- {data.iconname != undefined ? (
147
- <FontAwesome5
148
- name={data.iconname}
149
- size={normalize(
150
- data.iconsize != undefined ? data.iconsize : 15,
151
- )}
152
- color={data.iconcolor ? data.iconcolor : 'darkblue'}
153
- style={{
154
- paddingHorizontal: 5,
155
- width: normalize(26),
156
- justifyContent: 'flex-end',
157
- }}
158
- />
159
- ) : data.iconName ? (
160
- <MaterialCommunityIcons
161
- name={data.iconName}
162
- size={normalize(18)}
163
- color={data.iconcolor ? data.iconcolor : 'darkblue'}
164
- style={{
165
- paddingHorizontal: 5,
166
- width: normalize(26),
167
- justifyContent: 'flex-end',
168
- }}
169
- />
170
- ) : null}
171
- </TouchableOpacity>
172
- </MenuTrigger>
173
- <MenuOptions
174
- optionsContainerStyle={{
175
- marginTop: normalize(28),
176
- marginLeft: 0,
177
- borderWidth: 0,
178
- width:
179
- data.itemwidth != undefined
180
- ? parseFloat(data.itemwidth) - normalize(5) + '%'
181
- : '100%',
182
- }}>
183
- {props.columnid != undefined ? (
184
- <SHelpDescription
185
- column={props.columnid != undefined ? props.columnid : 0}
186
- width={
187
- data.itemwidth != undefined
188
- ? parseFloat(data.itemwidth) - normalize(5) + '%'
189
- : '100%'
190
- }
191
- />
192
- ) : null}
193
- </MenuOptions>
194
- </Menu>
195
- ) : null}
196
- <TextInput
197
- style={{
198
- padding: normalize(5),
199
- color: data.color != undefined ? data.color : 'black',
200
- fontWeight: data.fontWeight != undefined ? data.fontWeight : 'bold',
201
- borderWidth: 0,
202
- fontSize:
203
- data.fontSize != undefined ? data.fontSize : normalize(11),
204
- height: data.height != undefined ? data.height : normalize(36),
205
- width: '70%', // widthe changed from 90% to 70 %
206
- }}
207
- onChangeText={val => ChangeValue(val, props.validationkey)}
208
- multiline={true}
209
- onFocus={() => (setColorBg(true), (Global.HelpId = data.columnid))}
210
- onEndEditing={
211
- props.onEndEditing != undefined
212
- ? props.onEndEditing
213
- : () => getFocusOut()
214
- }
215
- autoCapitalize={
216
- data.capitalize != undefined ? data.capitalize : 'characters'
217
- }
218
- textAlign={data.textAlign != undefined ? data.textAlign : 'left'}
219
- keyboardType={data.type != undefined ? data.type : 'default'}
220
- maxLength={data.maxlength != undefined ? data.maxlength : 500}
221
- editable={data.editable != undefined ? data.editable : true}
222
- placeholder={data.placeholder != undefined ? data.placeholder : null}
223
- placeholderTextColor={
224
- data.placeholderTextColor != undefined
225
- ? data.placeholderTextColor
226
- : 'gray'
227
- }
228
- {...props}>
229
- {data.value != undefined ? data.value : ''}
230
- </TextInput>
231
- {/* {console.log("data.unit", JSON.stringify(data.editable))} */}
232
- </View>
233
-
234
- {/* {props.unit != undefined && props.unit != null && props.unit != "" ?
235
- <View style={{
236
- borderStyle: 'dotted', borderRadius:data.borderRadius?data.borderRadius: 5, alignItems: 'center', height: normalize(28), justifyContent: 'center',
237
- borderWidth: 1, marginLeft: 1, width: normalize(35), backgroundColor: '#f7f7f7', borderColor: 'darkblue'
238
- }}>
239
- <CText style={{
240
- fontWeight: 'bold', color: data.errorStatus != undefined
241
- && data.errorStatus ? 'red' : 'darkblue', fontSize: normalize(12),
242
- }}>{props.unit}</CText>
243
-
244
- </View> : null} */}
245
- {/* </View> */}
246
-
247
- {/* </View> */}
248
- </View>
249
- // <View style={{ borderWidth: 0, width: data.itemwidth ? (parseFloat(data.itemwidth) + 4) + '%' : '100%' }}>
250
- // {data.displaytext && (
251
- // <Text style={{ fontSize: 11, color: 'black', paddingHorizontal: 5, height: 15 }}>
252
- // {data.required && <Text style={{ color: 'red', fontSize: 13, fontWeight: 'bold' }}>* </Text>}
253
- // {data.displaytext || "Default"}
254
- // </Text>
255
- // )}
256
-
257
- // <View style={{
258
- // flexDirection: 'row',
259
- // borderWidth: 1,
260
- // borderRadius: data.borderRadius || 5,
261
- // alignItems: 'center',
262
- // backgroundColor: data.backgroundColor || '#fff',
263
- // borderColor: 'lightgrey',
264
- // }}>
265
- // {data.iconname || data.iconName ? (
266
- // <TouchableOpacity onPress={handleIconPress} style={{ paddingLeft: 3 }}>
267
- // {data.iconname ? (
268
- // <FontAwesome5 name={data.iconname} size={15} color={data.iconcolor || "darkblue"} />
269
- // ) : data.iconName ? (
270
- // <MaterialCommunityIcons name={data.iconName} size={18} color={data.iconcolor || "darkblue"} />
271
- // ) : null}
272
- // </TouchableOpacity>
273
- // ) : null}
274
-
275
- // <TextInput
276
- // ref={inputRef}
277
- // style={{
278
- // padding: 5,
279
- // color: data.color || 'black',
280
- // fontWeight: data.fontWeight || 'bold',
281
- // borderWidth: 0,
282
- // fontSize: data.fontSize || 12,
283
- // height: data.height || 36,
284
- // flex: 1 // Allow the TextInput to grow and take available space
285
- // }}
286
- // onChangeText={val => ChangeValue(val, props.validationkey)}
287
- // multiline={true}
288
- // onFocus={() => setColorBg(true)}
289
- // onEndEditing={props.onEndEditing || getFocusOut}
290
- // autoCapitalize={data.capitalize || 'characters'}
291
- // textAlign={data.textAlign || 'left'}
292
- // keyboardType={data.type || 'default'}
293
- // maxLength={data.maxlength || 500}
294
- // editable={data.editable !== undefined ? data.editable : true}
295
- // placeholder={data.placeholder || null}
296
- // {...props}
297
- // >
298
- // {data.value || ""}
299
- // </TextInput>
300
-
301
- // {menuVisible && (
302
- // <Menu
303
- // style={{
304
- // position: 'absolute',
305
- // top: menuPosition.top,
306
- // left: menuPosition.left,
307
- // borderWidth: 1,
308
- // width: data.itemwidth ? (parseFloat(data.itemwidth) + 4) + '%': '100%',
309
- // }}
310
- // >
311
- // <MenuOptions>
312
- // {props.columnid !== undefined && <SHelpDescription column={props.columnid} />}
313
- // </MenuOptions>
314
- // </Menu>
315
- // )}
316
- // </View>
317
- // </View>
318
- );
319
-
320
- function getFocusOut() {
321
- setColorBg(false);
322
- }
323
-
324
- function ChangeValue(changevalue, validationkey) {
325
- let datatype = data.datatype != undefined ? data.datatype : 'integer';
326
- let _error = changevalue == '' ? false : validate(changevalue, datatype);
327
- data.errorStatus = _error == false ? false : true;
328
- setText(changevalue);
329
- // props.callBack != undefined ? props.callBack(changevalue) : null
330
-
331
- switch (validationkey) {
332
- case 1:
333
- validateEmail(text);
334
- props.callBack != undefined
335
- ? props.callBack(changevalue, validateEmail(text))
336
- : null;
337
- break;
338
-
339
- default:
340
- props.callBack != undefined ? props.callBack(changevalue) : null;
341
- break;
342
- }
343
- }
344
-
345
- function validate(text, datatype) {
346
- let status = true;
347
- switch (datatype) {
348
- case 'integer':
349
- let integerRegex = /^[0-9]*$/;
350
- if (integerRegex.exec(text)) {
351
- if (data.minvalue == null && data.maxvalue == null) {
352
- status = false;
353
- } else if (data.minvalue == null) {
354
- if (data.maxvalue == '') {
355
- status = false;
356
- } else {
357
- if (text <= data.maxvalue) {
358
- status = false;
359
- } else {
360
- status = true;
361
- }
362
- }
363
- } else if (data.maxvalue == null) {
364
- if (data.minvalue == '') {
365
- status = false;
366
- } else {
367
- if (text >= data.minvalue) {
368
- status = false;
369
- } else {
370
- status = true;
371
- }
372
- }
373
- } else if (data.minvalue == '' && data.maxvalue == '') {
374
- status = false;
375
- } else if (data.minvalue == '') {
376
- if (text <= data.maxvalue) {
377
- status = false;
378
- } else {
379
- status = true;
380
- }
381
- } else if (data.maxvalue == '') {
382
- if (text >= data.minvalue) {
383
- status = false;
384
- } else {
385
- status = true;
386
- }
387
- } else {
388
- if (text >= data.minvalue && text <= data.maxvalue) {
389
- status = false;
390
- } else {
391
- status = true;
392
- }
393
- }
394
- } else {
395
- status = true;
396
- }
397
- break;
398
- case 'password':
399
- let passwordRegex = /[0-9a-zA-Z]/;
400
- if (passwordRegex.exec(text)) {status = false;}
401
- else {status = true;}
402
- break;
403
- case 'string':
404
- let stringRegex = /^[a-zA-Z0-9.!#$%&@\s]*$/;
405
- if (stringRegex.exec(text)) {
406
- let minvalue = data.minvalue;
407
- let maxvalue = data.maxvalue;
408
- let length = text == null ? 0 : text.length;
409
- if (minvalue == null && maxvalue == null) {
410
- status = false;
411
- } else if (minvalue == null) {
412
- if (maxvalue == '') {
413
- status = false;
414
- } else {
415
- if (length <= maxvalue) {
416
- status = false;
417
- } else {
418
- status = true;
419
- }
420
- }
421
- } else if (maxvalue == null) {
422
- if (minvalue == '') {
423
- status = false;
424
- } else {
425
- if (length >= minvalue) {
426
- status = false;
427
- } else {
428
- status = true;
429
- }
430
- }
431
- } else if (minvalue == '' && maxvalue == '') {
432
- status = false;
433
- } else if (minvalue == '') {
434
- if (length <= maxvalue) {
435
- status = false;
436
- } else {
437
- status = true;
438
- }
439
- } else if (maxvalue == '') {
440
- if (length >= minvalue) {
441
- status = false;
442
- } else {
443
- status = true;
444
- }
445
- } else {
446
- if (length >= minvalue && length <= maxvalue) {
447
- status = false;
448
- } else {
449
- status = true;
450
- }
451
- }
452
- } else {
453
- status = true;
454
- }
455
- break;
456
- case 'numeric':
457
- let numericRegex = /^[0-9.]*$/;
458
- if (numericRegex.exec(text)) {
459
- if (data.minvalue == null && data.maxvalue == null) {
460
- status = false;
461
- } else if (data.minvalue == null) {
462
- if (data.maxvalue == '') {
463
- status = false;
464
- } else {
465
- if (text <= data.maxvalue) {
466
- status = false;
467
- } else {
468
- status = true;
469
- }
470
- }
471
- } else if (data.maxvalue == null) {
472
- if (data.minvalue == '') {
473
- status = false;
474
- } else {
475
- if (text >= data.minvalue) {
476
- status = false;
477
- } else {
478
- status = true;
479
- }
480
- }
481
- } else if (data.minvalue == '' && data.maxvalue == '') {
482
- status = false;
483
- } else if (data.minvalue == '') {
484
- if (text <= data.maxvalue) {
485
- status = false;
486
- } else {
487
- status = true;
488
- }
489
- } else if (data.maxvalue == '') {
490
- if (text >= data.minvalue) {
491
- status = false;
492
- } else {
493
- status = true;
494
- }
495
- } else {
496
- if (text >= data.minvalue && text <= data.maxvalue) {
497
- status = false;
498
- } else {
499
- status = true;
500
- }
501
- }
502
- } else {
503
- status = true;
504
- }
505
- break;
506
- }
507
- return status;
508
- }
509
- };
510
- export default STextInputNew;