@wavemaker/app-rn-runtime 12.0.0-next.141192 → 12.0.0-next.141936

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. app-rn-runtime/components/advanced/carousel/carousel.component.js +1 -0
  2. app-rn-runtime/components/advanced/carousel/carousel.component.js.map +1 -1
  3. app-rn-runtime/components/basic/custom/custom.component.js +1 -1
  4. app-rn-runtime/components/basic/custom/custom.component.js.map +1 -1
  5. app-rn-runtime/components/basic/lottie/lottie.component.js +3 -1
  6. app-rn-runtime/components/basic/lottie/lottie.component.js.map +1 -1
  7. app-rn-runtime/components/basic/search/search.component.js +1 -1
  8. app-rn-runtime/components/basic/search/search.component.js.map +1 -1
  9. app-rn-runtime/components/basic/search/search.props.js +1 -0
  10. app-rn-runtime/components/basic/search/search.props.js.map +1 -1
  11. app-rn-runtime/components/basic/skeleton/skeleton.component.js +2 -0
  12. app-rn-runtime/components/basic/skeleton/skeleton.component.js.map +1 -1
  13. app-rn-runtime/components/container/container.component.js +8 -1
  14. app-rn-runtime/components/container/container.component.js.map +1 -1
  15. app-rn-runtime/components/container/container.props.js +1 -0
  16. app-rn-runtime/components/container/container.props.js.map +1 -1
  17. app-rn-runtime/components/container/tabs/tabpane/tabpane.props.js +1 -0
  18. app-rn-runtime/components/container/tabs/tabpane/tabpane.props.js.map +1 -1
  19. app-rn-runtime/components/container/tabs/tabs.component.js +3 -1
  20. app-rn-runtime/components/container/tabs/tabs.component.js.map +1 -1
  21. app-rn-runtime/components/input/baseinput/baseinput.component.js +46 -10
  22. app-rn-runtime/components/input/baseinput/baseinput.component.js.map +1 -1
  23. app-rn-runtime/components/input/basenumber/basenumber.component.js +16 -3
  24. app-rn-runtime/components/input/basenumber/basenumber.component.js.map +1 -1
  25. app-rn-runtime/components/input/checkbox/checkbox.component.js +2 -2
  26. app-rn-runtime/components/input/checkbox/checkbox.component.js.map +1 -1
  27. app-rn-runtime/components/input/checkbox/checkbox.styles.js +3 -1
  28. app-rn-runtime/components/input/checkbox/checkbox.styles.js.map +1 -1
  29. app-rn-runtime/components/input/currency/currency.component.js +3 -1
  30. app-rn-runtime/components/input/currency/currency.component.js.map +1 -1
  31. app-rn-runtime/components/input/currency/currency.styles.js +6 -1
  32. app-rn-runtime/components/input/currency/currency.styles.js.map +1 -1
  33. app-rn-runtime/components/input/epoch/base-datetime.component.js +4 -3
  34. app-rn-runtime/components/input/epoch/base-datetime.component.js.map +1 -1
  35. app-rn-runtime/components/input/number/number.component.js +3 -1
  36. app-rn-runtime/components/input/number/number.component.js.map +1 -1
  37. app-rn-runtime/components/input/number/number.styles.js +3 -0
  38. app-rn-runtime/components/input/number/number.styles.js.map +1 -1
  39. app-rn-runtime/components/input/radioset/radioset.component.js +12 -7
  40. app-rn-runtime/components/input/radioset/radioset.component.js.map +1 -1
  41. app-rn-runtime/components/input/radioset/radioset.props.js +1 -0
  42. app-rn-runtime/components/input/radioset/radioset.props.js.map +1 -1
  43. app-rn-runtime/components/input/radioset/radioset.styles.js +6 -0
  44. app-rn-runtime/components/input/radioset/radioset.styles.js.map +1 -1
  45. app-rn-runtime/components/input/text/text.component.js +5 -2
  46. app-rn-runtime/components/input/text/text.component.js.map +1 -1
  47. app-rn-runtime/components/input/text/text.props.js +1 -0
  48. app-rn-runtime/components/input/text/text.props.js.map +1 -1
  49. app-rn-runtime/components/input/text/text.styles.js +3 -0
  50. app-rn-runtime/components/input/text/text.styles.js.map +1 -1
  51. app-rn-runtime/components/input/textarea/textarea.component.js +3 -1
  52. app-rn-runtime/components/input/textarea/textarea.component.js.map +1 -1
  53. app-rn-runtime/components/input/textarea/textarea.styles.js +3 -0
  54. app-rn-runtime/components/input/textarea/textarea.styles.js.map +1 -1
  55. app-rn-runtime/components/page/content/content.component.js +4 -19
  56. app-rn-runtime/components/page/content/content.component.js.map +1 -1
  57. app-rn-runtime/components/page/left-panel/left-panel.component.js +4 -1
  58. app-rn-runtime/components/page/left-panel/left-panel.component.js.map +1 -1
  59. app-rn-runtime/components/page/page-content/page-content.component.js +43 -12
  60. app-rn-runtime/components/page/page-content/page-content.component.js.map +1 -1
  61. app-rn-runtime/core/AppConfig.js.map +1 -1
  62. app-rn-runtime/core/base.component.js +31 -5
  63. app-rn-runtime/core/base.component.js.map +1 -1
  64. app-rn-runtime/core/components/textinput.component.js +9 -7
  65. app-rn-runtime/core/components/textinput.component.js.map +1 -1
  66. app-rn-runtime/core/storage.service.js +15 -0
  67. app-rn-runtime/core/storage.service.js.map +1 -1
  68. app-rn-runtime/core/wm-component-tree.js +58 -0
  69. app-rn-runtime/core/wm-component-tree.js.map +1 -0
  70. app-rn-runtime/package.json +13 -6
  71. app-rn-runtime/runtime/App.js +17 -2
  72. app-rn-runtime/runtime/App.js.map +1 -1
  73. app-rn-runtime/runtime/App.navigator.js +1 -0
  74. app-rn-runtime/runtime/App.navigator.js.map +1 -1
  75. app-rn-runtime/runtime/base-fragment.component.js +18 -0
  76. app-rn-runtime/runtime/base-fragment.component.js.map +1 -1
  77. app-rn-runtime/runtime/base-page.component.js +10 -0
  78. app-rn-runtime/runtime/base-page.component.js.map +1 -1
  79. app-rn-runtime/runtime/base-partial.component.js +3 -0
  80. app-rn-runtime/runtime/base-partial.component.js.map +1 -1
  81. app-rn-runtime/runtime/navigator/drawer.navigator.js +19 -10
  82. app-rn-runtime/runtime/navigator/drawer.navigator.js.map +1 -1
  83. app-rn-runtime/styles/theme.js +5 -0
  84. app-rn-runtime/styles/theme.js.map +1 -1
  85. app-rn-runtime/styles/theme.variables.js +1 -1
  86. app-rn-runtime/styles/theme.variables.js.map +1 -1
  87. app-rn-runtime/variables/http.service.js +5 -1
  88. app-rn-runtime/variables/http.service.js.map +1 -1
  89. app-rn-runtime/variables/live-variable.js +14 -0
  90. app-rn-runtime/variables/live-variable.js.map +1 -1
@@ -8,6 +8,7 @@ export default class WmContainerProps extends PartialHostProps {
8
8
  _defineProperty(this, "animation", null);
9
9
  _defineProperty(this, "animationdelay", null);
10
10
  _defineProperty(this, "onLoad", void 0);
11
+ _defineProperty(this, "scrollable", false);
11
12
  }
12
13
  }
13
14
  //# sourceMappingURL=container.props.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["PartialHostProps","WmContainerProps","constructor","args","_defineProperty"],"sources":["container.props.ts"],"sourcesContent":["import { PartialHostProps } from './partial-host.component';\n\nexport default class WmContainerProps extends PartialHostProps {\n animation?: string = null as any;\n animationdelay?: number = null as any;\n onLoad?: Function;\n}\n"],"mappings":";;;AAAA,SAASA,gBAAgB,QAAQ,0BAA0B;AAE3D,eAAe,MAAMC,gBAAgB,SAASD,gBAAgB,CAAC;EAAAE,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,oBACxC,IAAI;IAAAA,eAAA,yBACC,IAAI;IAAAA,eAAA;EAAA;AAEhC","ignoreList":[]}
1
+ {"version":3,"names":["PartialHostProps","WmContainerProps","constructor","args","_defineProperty"],"sources":["container.props.ts"],"sourcesContent":["import { PartialHostProps } from './partial-host.component';\n\nexport default class WmContainerProps extends PartialHostProps {\n animation?: string = null as any;\n animationdelay?: number = null as any;\n onLoad?: Function;\n scrollable?: Boolean = false as any;\n}\n"],"mappings":";;;AAAA,SAASA,gBAAgB,QAAQ,0BAA0B;AAE3D,eAAe,MAAMC,gBAAgB,SAASD,gBAAgB,CAAC;EAAAE,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,oBACxC,IAAI;IAAAA,eAAA,yBACC,IAAI;IAAAA,eAAA;IAAAA,eAAA,qBAEP,KAAK;EAAA;AAC9B","ignoreList":[]}
@@ -10,6 +10,7 @@ export default class WmTabpaneProps extends BaseProps {
10
10
  _defineProperty(this, "title", 'Tab Title');
11
11
  _defineProperty(this, "renderPartial", void 0);
12
12
  _defineProperty(this, "isPartialLoaded", false);
13
+ _defineProperty(this, "invokeVariables", true);
13
14
  }
14
15
  }
15
16
  //# sourceMappingURL=tabpane.props.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["BaseProps","WmTabpaneProps","constructor","args","_defineProperty"],"sources":["tabpane.props.ts"],"sourcesContent":["import { BaseProps } from '@wavemaker/app-rn-runtime/core/base.component';\n\nexport default class WmTabpaneProps extends BaseProps {\n children?: any;\n paneicon?: string = null as any;\n title: string = 'Tab Title';\n renderPartial?: Function;\n isPartialLoaded? = false;\n}\n"],"mappings":";;;AAAA,SAASA,SAAS,QAAQ,+CAA+C;AAEzE,eAAe,MAAMC,cAAc,SAASD,SAAS,CAAC;EAAAE,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA;IAAAA,eAAA,mBAEhC,IAAI;IAAAA,eAAA,gBACR,WAAW;IAAAA,eAAA;IAAAA,eAAA,0BAER,KAAK;EAAA;AAC1B","ignoreList":[]}
1
+ {"version":3,"names":["BaseProps","WmTabpaneProps","constructor","args","_defineProperty"],"sources":["tabpane.props.ts"],"sourcesContent":["import { BaseProps } from '@wavemaker/app-rn-runtime/core/base.component';\n\nexport default class WmTabpaneProps extends BaseProps {\n children?: any;\n paneicon?: string = null as any;\n title: string = 'Tab Title';\n renderPartial?: Function;\n isPartialLoaded? = false;\n invokeVariables = true;\n}\n"],"mappings":";;;AAAA,SAASA,SAAS,QAAQ,+CAA+C;AAEzE,eAAe,MAAMC,cAAc,SAASD,SAAS,CAAC;EAAAE,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA;IAAAA,eAAA,mBAEhC,IAAI;IAAAA,eAAA,gBACR,WAAW;IAAAA,eAAA;IAAAA,eAAA,0BAER,KAAK;IAAAA,eAAA,0BACN,IAAI;EAAA;AACxB","ignoreList":[]}
@@ -173,7 +173,9 @@ export default class WmTabs extends BaseComponent {
173
173
  alignSelf: 'flex-start'
174
174
  },
175
175
  onLayout: this.setTabPaneHeights.bind(this, i)
176
- }, p);
176
+ }, /*#__PURE__*/React.cloneElement(p, {
177
+ "invokeVariables": false
178
+ }));
177
179
  }))));
178
180
  }
179
181
  renderSkeleton(props) {
@@ -1 +1 @@
1
- {"version":3,"names":["React","View","BaseComponent","BaseComponentState","SwipeAnimation","isWebPreviewMode","WmTabsProps","DEFAULT_CLASS","WmTabheader","createSkeleton","WmTabsState","constructor","args","_defineProperty","WmTabs","props","bounds","e","_this$tabLayout","activeTabIndex","state","selectedTabIndex","w","tabLayout","width","noOfTabs","tabPanes","length","lower","center","upper","onLower","onChange","onUpper","setTabLayout","event","nativeEvent","layout","forceUpdate","goToTab","setTabPaneHeights","index","_nativeEvent$nativeEv","tabPaneHeights","height","setTabShown","tabIndex","callback","tabsShown","setTimeout","updateState","addTabPane","tabPane","paneId","newIndex","i","findIndex","t","push","removeTabPane","splice","selectTabPane","indexOf","selectedTabPane","_this$tabLayout2","position","animationView","setPosition","then","prev","_this$animationView","goToLower","next","_this$animationView2","oldIndex","deselectedTab","_onDeselect","selectedTab","_onSelect","invokeEventCallback","proxy","renderSkeletonContent","Children","toArray","children","filter","item","show","headerData","map","p","title","icon","key","createElement","style","styles","root","borderBottomWidth","onLayout","bind","tabHeader","data","showskeleton","overflow","flexDirection","flexWrap","alignSelf","renderSkeleton","showskeletonchildren","_this$props","skeletonStyles","skeleton","text","theme","opacity","onPropertyChange","name","$new","$old","selectedIndex","getBackground","_showSkeleton","_background","renderWidget","paneicon","id","getTestId","onIndexChange","flex","maxHeight","tabContent","enableGestures","enablegestures","alignItems","direction","ref","r","handlers","animationHandlers","undefined"],"sources":["tabs.component.tsx"],"sourcesContent":["import React from 'react';\nimport { LayoutChangeEvent, LayoutRectangle, View } from 'react-native';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport * as SwipeAnimation from '@wavemaker/app-rn-runtime/gestures/swipe.animation';\nimport { isWebPreviewMode } from '@wavemaker/app-rn-runtime/core/utils';\n\nimport WmTabsProps from './tabs.props';\nimport { DEFAULT_CLASS, WmTabsStyles } from './tabs.styles';\nimport WmTabpane from './tabpane/tabpane.component';\nimport WmTabheader from './tabheader/tabheader.component';\nimport { WmSkeletonStyles } from '@wavemaker/app-rn-runtime/components/basic/skeleton/skeleton.styles';\nimport { createSkeleton } from '@wavemaker/app-rn-runtime/components/basic/skeleton/skeleton.component';\n\nexport class WmTabsState extends BaseComponentState<WmTabsProps> {\n tabsShown: boolean[] = [];\n selectedTabIndex: number = 0;\n}\n\nexport default class WmTabs extends BaseComponent<WmTabsProps, WmTabsState, WmTabsStyles> {\n public tabPanes = [] as WmTabpane[];\n private newIndex = 0;\n private tabLayout: LayoutRectangle = null as any;\n private tabPaneHeights: number[] = [];\n private animationView: SwipeAnimation.View | null = null as any;\n private animationHandlers = {\n bounds: (e) => {\n const activeTabIndex = this.state.selectedTabIndex,\n w = this.tabLayout?.width || 0,\n noOfTabs = this.tabPanes.length;\n return {\n lower: -1 * (activeTabIndex - (activeTabIndex === 0 ? 0 : 1)) * w,\n center: -1 * activeTabIndex * w,\n upper: -1 * (activeTabIndex + (activeTabIndex === noOfTabs - 1 ? 0 : 1)) * w\n };\n },\n onLower: (e) => {\n this.onChange(this.state.selectedTabIndex - 1);\n },\n onUpper: (e) => {\n this.onChange(this.state.selectedTabIndex + 1);\n }\n } as SwipeAnimation.Handlers;\n\n constructor(props: WmTabsProps) {\n super(props, DEFAULT_CLASS, new WmTabsProps(), new WmTabsState());\n }\n\n setTabLayout(event: LayoutChangeEvent) {\n this.tabLayout = event.nativeEvent.layout;\n this.forceUpdate(() => {\n this.goToTab();\n });\n }\n\n setTabPaneHeights(index: number, nativeEvent: LayoutChangeEvent) {\n this.tabPaneHeights[index] = nativeEvent.nativeEvent.layout?.height;\n if (index === this.state.selectedTabIndex) {\n this.forceUpdate();\n }\n }\n\n setTabShown(tabIndex: number, callback: () => any) {\n if (!this.state.tabsShown[tabIndex]) {\n const tabsShown = [...this.state.tabsShown];\n tabsShown[tabIndex] = true;\n setTimeout(() => {\n this.updateState({\n tabsShown: tabsShown\n } as WmTabsState, callback);\n }, 300);\n } else {\n callback && callback();\n }\n }\n\n addTabPane(tabPane: WmTabpane) {\n tabPane.paneId = `tabPane${this.newIndex++}`;\n const i = this.tabPanes.findIndex(t => t.paneId === tabPane.paneId);\n if (i >= 0) {\n this.tabPanes[i] = tabPane;\n } else {\n this.tabPanes.push(tabPane)\n }\n }\n\n removeTabPane(tabPane: WmTabpane) {\n const i = this.tabPanes.findIndex(t => t.paneId === tabPane.paneId);\n if (i >= 0) {\n this.tabPanes.splice(i, 1); \n this.newIndex--;\n }\n }\n\n selectTabPane(tabPane: WmTabpane) {\n this.goToTab(this.tabPanes.indexOf(tabPane));\n }\n\n get selectedTabPane() {\n return this.tabPanes[this.state.selectedTabIndex];\n }\n\n goToTab(index = this.state.selectedTabIndex) {\n if (index < 0 || index >= this.tabPanes.length) {\n return;\n }\n const position = -1 * index * (this.tabLayout?.width || 0);\n if(this.animationView) {\n this.animationView.setPosition(position)\n .then(() => this.onChange(index));\n } else {\n this.onChange(index);\n }\n }\n\n prev() {\n this.animationView?.goToLower();\n }\n\n next() {\n this.animationView?.goToLower();\n }\n\n onChange(newIndex: number) {\n if (newIndex < 0 || newIndex >= this.tabPanes.length) {\n return;\n }\n const oldIndex = this.state.selectedTabIndex;\n const deselectedTab = this.tabPanes[this.state.selectedTabIndex];\n this.newIndex = newIndex;\n deselectedTab?._onDeselect();\n this.updateState({\n selectedTabIndex: newIndex\n } as WmTabsState, () => {\n this.setTabShown(newIndex, () => {\n const selectedTab = this.tabPanes[newIndex];\n selectedTab?._onSelect();\n this.invokeEventCallback('onChange', [{}, this.proxy, newIndex, oldIndex]);\n });\n });\n }\n\n public renderSkeletonContent(props: WmTabsProps) {\n const tabPanes = React.Children.toArray(this.props.children)\n .filter((item: any, index: number) => item.props.show != false);\n const headerData = tabPanes.map((p: any, i: number) =>\n ({title: p.props.title || 'Tab Title', icon: '', key: `tab-${p.props.title}-${i}`}));\n return(\n <View style={[this.styles.root, { borderBottomWidth: 0}]}>\n <View onLayout={this.setTabLayout.bind(this)} style={{width: '100%'}}></View>\n <WmTabheader\n styles={this.styles.tabHeader}\n data={headerData}\n showskeleton={this.props.showskeleton}\n selectedTabIndex={this.state.selectedTabIndex}\n ></WmTabheader>\n <View\n //{...this.panResponder.panHandlers}\n style={{\n width: '100%',\n //height: this.tabPaneHeights[this.state.selectedTabIndex],\n overflow: 'hidden'\n }} >\n <View style={{\n flexDirection: 'row',\n flexWrap: 'nowrap'\n }}>\n {tabPanes.map((p: any, i) => {\n return (\n <View\n key={`tab-${p.props.title}-${i}`}\n style={{width: '100%', alignSelf: 'flex-start'}}\n onLayout={this.setTabPaneHeights.bind(this, i)}>\n {/* {this.state.tabsShown[i] ? p : null} */}\n {p}\n </View>);\n })}\n </View>\n </View>\n </View>\n )\n }\n\n public renderSkeleton(props: WmTabsProps){\n if(!props.showskeletonchildren) {\n const skeletonStyles: WmSkeletonStyles = this.props?.styles?.skeleton || { root: {}, text: {} } as WmSkeletonStyles\n return createSkeleton(this.theme, skeletonStyles, {\n ...this.styles.root\n }, (<View style={[this.styles.root, { opacity: 0 }]}>\n {this.renderSkeletonContent(props)}\n </View>)) \n }\n return this.renderSkeletonContent(props);\n }\n\n public onPropertyChange(name: string, $new: any, $old: any): void {\n super.onPropertyChange(name, $new, $old);\n switch(name) {\n case \"defaultpaneindex\":\n const selectedIndex = $new || 0;\n const tabsShown: boolean[] = [];\n tabsShown[selectedIndex] = true;\n this.updateState({\n selectedTabIndex: selectedIndex,\n tabsShown: tabsShown\n } as WmTabsState);\n }\n }\n\n getBackground(): React.JSX.Element | null {\n return this._showSkeleton ? null : this._background\n } \n\n\n renderWidget(props: WmTabsProps) {\n const tabPanes = React.Children.toArray(props.children)\n .filter((item: any, index: number) => item.props.show != false);\n const headerData = tabPanes.map((p: any, i: number) =>\n ({title: p.props.title || 'Tab Title', icon: p.props.paneicon || '', key: `tab-${p.props.title}-${i}`}));\n const styles = this._showSkeleton ? {\n ...this.styles.root,\n ...this.styles.skeleton.root\n } : this.styles.root\n return (\n <View style={styles}>\n {this.getBackground()}\n <View onLayout={this.setTabLayout.bind(this)} style={{width: '100%'}}></View>\n <WmTabheader\n id={this.getTestId('headers')}\n styles={this.styles.tabHeader}\n data={headerData}\n selectedTabIndex={this.state.selectedTabIndex}\n onIndexChange={this.goToTab.bind(this)}\n ></WmTabheader>\n <View\n style={[{\n width: '100%',\n flex: 1\n }, this.styles.root.height ?\n (isWebPreviewMode() ? {'overflowX': 'hidden','overflowY': 'auto'} as any : {overflow: 'scroll'})\n : {\n overflow: 'hidden',\n maxHeight: this.tabPaneHeights[this.state.selectedTabIndex],\n }, this.styles.tabContent]} >\n <SwipeAnimation.View\n enableGestures={props.enablegestures}\n style={{\n flexDirection: 'row',\n flexWrap: 'nowrap',\n alignItems: 'flex-start'\n }}\n direction='horizontal'\n ref={(r) => {this.animationView = r}}\n handlers = {this.animationHandlers}\n >\n {tabPanes.map((p: any, i) => {\n return (\n <View\n key={`tab-${p.props.title}-${i}`}\n style={{\n width: '100%',\n height: this.styles.root.height ? undefined : 1000000,\n alignSelf: 'flex-start'}}>\n <View\n style={{width: '100%', alignSelf: 'flex-start'}}\n onLayout={this.setTabPaneHeights.bind(this, i)}>\n {/* {this.state.tabsShown[i] ? p : null} */}\n {p}\n </View>\n </View>);\n })}\n </SwipeAnimation.View>\n </View>\n </View>\n );\n }\n}\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAA6CC,IAAI,QAAQ,cAAc;AACvE,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AACjG,OAAO,KAAKC,cAAc,MAAM,oDAAoD;AACpF,SAASC,gBAAgB,QAAQ,sCAAsC;AAEvE,OAAOC,WAAW,MAAM,cAAc;AACtC,SAASC,aAAa,QAAsB,eAAe;AAE3D,OAAOC,WAAW,MAAM,iCAAiC;AAEzD,SAASC,cAAc,QAAQ,wEAAwE;AAEvG,OAAO,MAAMC,WAAW,SAASP,kBAAkB,CAAc;EAAAQ,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,oBACxC,EAAE;IAAAA,eAAA,2BACE,CAAC;EAAA;AA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KAAK,EAAE;QACLU,aAAa,EAAE,KAAK;QACpBC,QAAQ,EAAE,QAAQ;QAClB4B,UAAU,EAAE;MACd,CAAE;MACFC,SAAS,EAAC,YAAY;MACtBC,GAAG,EAAGC,CAAC,IAAK;QAAC,IAAI,CAACvE,aAAa,GAAGuE,CAAC;MAAA,CAAE;MACrCC,QAAQ,EAAI,IAAI,CAACC;IAAkB,GAElCjH,QAAQ,CAAC+D,GAAG,CAAC,CAACC,CAAM,EAAEnC,CAAC,KAAK;MAC3B,oBACAvD,KAAA,CAAA8F,aAAA,CAAC7F,IAAI;QACH4F,GAAG,EAAE,OAAOH,CAAC,CAAC3E,KAAK,CAAC4E,KAAK,IAAIpC,CAAC,EAAG;QACjCwC,KAAK,EAAE;UACLvE,KAAK,EAAE,MAAM;UACboB,MAAM,EAAE,IAAI,CAACoD,MAAM,CAACC,IAAI,CAACrD,MAAM,GAAIgG,SAAS,GAAG,OAAO;UACtDjC,SAAS,EAAE;QAAY;MAAE,gBAC3B3G,KAAA,CAAA8F,aAAA,CAAC7F,IAAI;QACH8F,KAAK,EAAE;UAACvE,KAAK,EAAE,MAAM;UAAEmF,SAAS,EAAE;QAAY,CAAE;QAChDR,QAAQ,EAAE,IAAI,CAAC3D,iBAAiB,CAAC4D,IAAI,CAAC,IAAI,EAAE7C,CAAC;MAAE,GAE9CmC,CACG,CACF,CAAC;IACT,CAAC,CACkB,CACjB,CACF,CAAC;EAEX;AACF","ignoreList":[]}
1
+ {"version":3,"names":["React","View","BaseComponent","BaseComponentState","SwipeAnimation","isWebPreviewMode","WmTabsProps","DEFAULT_CLASS","WmTabheader","createSkeleton","WmTabsState","constructor","args","_defineProperty","WmTabs","props","bounds","e","_this$tabLayout","activeTabIndex","state","selectedTabIndex","w","tabLayout","width","noOfTabs","tabPanes","length","lower","center","upper","onLower","onChange","onUpper","setTabLayout","event","nativeEvent","layout","forceUpdate","goToTab","setTabPaneHeights","index","_nativeEvent$nativeEv","tabPaneHeights","height","setTabShown","tabIndex","callback","tabsShown","setTimeout","updateState","addTabPane","tabPane","paneId","newIndex","i","findIndex","t","push","removeTabPane","splice","selectTabPane","indexOf","selectedTabPane","_this$tabLayout2","position","animationView","setPosition","then","prev","_this$animationView","goToLower","next","_this$animationView2","oldIndex","deselectedTab","_onDeselect","selectedTab","_onSelect","invokeEventCallback","proxy","renderSkeletonContent","Children","toArray","children","filter","item","show","headerData","map","p","title","icon","key","createElement","style","styles","root","borderBottomWidth","onLayout","bind","tabHeader","data","showskeleton","overflow","flexDirection","flexWrap","alignSelf","cloneElement","renderSkeleton","showskeletonchildren","_this$props","skeletonStyles","skeleton","text","theme","opacity","onPropertyChange","name","$new","$old","selectedIndex","getBackground","_showSkeleton","_background","renderWidget","paneicon","id","getTestId","onIndexChange","flex","maxHeight","tabContent","enableGestures","enablegestures","alignItems","direction","ref","r","handlers","animationHandlers","undefined"],"sources":["tabs.component.tsx"],"sourcesContent":["import React from 'react';\nimport { LayoutChangeEvent, LayoutRectangle, View } from 'react-native';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport * as SwipeAnimation from '@wavemaker/app-rn-runtime/gestures/swipe.animation';\nimport { isWebPreviewMode } from '@wavemaker/app-rn-runtime/core/utils';\n\nimport WmTabsProps from './tabs.props';\nimport { DEFAULT_CLASS, WmTabsStyles } from './tabs.styles';\nimport WmTabpane from './tabpane/tabpane.component';\nimport WmTabheader from './tabheader/tabheader.component';\nimport { WmSkeletonStyles } from '@wavemaker/app-rn-runtime/components/basic/skeleton/skeleton.styles';\nimport { createSkeleton } from '@wavemaker/app-rn-runtime/components/basic/skeleton/skeleton.component';\n\nexport class WmTabsState extends BaseComponentState<WmTabsProps> {\n tabsShown: boolean[] = [];\n selectedTabIndex: number = 0;\n}\n\nexport default class WmTabs extends BaseComponent<WmTabsProps, WmTabsState, WmTabsStyles> {\n public tabPanes = [] as WmTabpane[];\n private newIndex = 0;\n private tabLayout: LayoutRectangle = null as any;\n private tabPaneHeights: number[] = [];\n private animationView: SwipeAnimation.View | null = null as any;\n private animationHandlers = {\n bounds: (e) => {\n const activeTabIndex = this.state.selectedTabIndex,\n w = this.tabLayout?.width || 0,\n noOfTabs = this.tabPanes.length;\n return {\n lower: -1 * (activeTabIndex - (activeTabIndex === 0 ? 0 : 1)) * w,\n center: -1 * activeTabIndex * w,\n upper: -1 * (activeTabIndex + (activeTabIndex === noOfTabs - 1 ? 0 : 1)) * w\n };\n },\n onLower: (e) => {\n this.onChange(this.state.selectedTabIndex - 1);\n },\n onUpper: (e) => {\n this.onChange(this.state.selectedTabIndex + 1);\n }\n } as SwipeAnimation.Handlers;\n\n constructor(props: WmTabsProps) {\n super(props, DEFAULT_CLASS, new WmTabsProps(), new WmTabsState());\n }\n\n setTabLayout(event: LayoutChangeEvent) {\n this.tabLayout = event.nativeEvent.layout;\n this.forceUpdate(() => {\n this.goToTab();\n });\n }\n\n setTabPaneHeights(index: number, nativeEvent: LayoutChangeEvent) {\n this.tabPaneHeights[index] = nativeEvent.nativeEvent.layout?.height;\n if (index === this.state.selectedTabIndex) {\n this.forceUpdate();\n }\n }\n\n setTabShown(tabIndex: number, callback: () => any) {\n if (!this.state.tabsShown[tabIndex]) {\n const tabsShown = [...this.state.tabsShown];\n tabsShown[tabIndex] = true;\n setTimeout(() => {\n this.updateState({\n tabsShown: tabsShown\n } as WmTabsState, callback);\n }, 300);\n } else {\n callback && callback();\n }\n }\n\n addTabPane(tabPane: WmTabpane) {\n tabPane.paneId = `tabPane${this.newIndex++}`;\n const i = this.tabPanes.findIndex(t => t.paneId === tabPane.paneId);\n if (i >= 0) {\n this.tabPanes[i] = tabPane;\n } else {\n this.tabPanes.push(tabPane)\n }\n }\n\n removeTabPane(tabPane: WmTabpane) {\n const i = this.tabPanes.findIndex(t => t.paneId === tabPane.paneId);\n if (i >= 0) {\n this.tabPanes.splice(i, 1); \n this.newIndex--;\n }\n }\n\n selectTabPane(tabPane: WmTabpane) {\n this.goToTab(this.tabPanes.indexOf(tabPane));\n }\n\n get selectedTabPane() {\n return this.tabPanes[this.state.selectedTabIndex];\n }\n\n goToTab(index = this.state.selectedTabIndex) {\n if (index < 0 || index >= this.tabPanes.length) {\n return;\n }\n const position = -1 * index * (this.tabLayout?.width || 0);\n if(this.animationView) {\n this.animationView.setPosition(position)\n .then(() => this.onChange(index));\n } else {\n this.onChange(index);\n }\n }\n\n prev() {\n this.animationView?.goToLower();\n }\n\n next() {\n this.animationView?.goToLower();\n }\n\n onChange(newIndex: number) {\n if (newIndex < 0 || newIndex >= this.tabPanes.length) {\n return;\n }\n const oldIndex = this.state.selectedTabIndex;\n const deselectedTab = this.tabPanes[this.state.selectedTabIndex];\n this.newIndex = newIndex;\n deselectedTab?._onDeselect();\n this.updateState({\n selectedTabIndex: newIndex\n } as WmTabsState, () => {\n this.setTabShown(newIndex, () => {\n const selectedTab = this.tabPanes[newIndex];\n selectedTab?._onSelect();\n this.invokeEventCallback('onChange', [{}, this.proxy, newIndex, oldIndex]);\n });\n });\n }\n\n public renderSkeletonContent(props: WmTabsProps) {\n const tabPanes = React.Children.toArray(this.props.children)\n .filter((item: any, index: number) => item.props.show != false);\n const headerData = tabPanes.map((p: any, i: number) =>\n ({title: p.props.title || 'Tab Title', icon: '', key: `tab-${p.props.title}-${i}`}));\n return(\n <View style={[this.styles.root, { borderBottomWidth: 0}]}>\n <View onLayout={this.setTabLayout.bind(this)} style={{width: '100%'}}></View>\n <WmTabheader\n styles={this.styles.tabHeader}\n data={headerData}\n showskeleton={this.props.showskeleton}\n selectedTabIndex={this.state.selectedTabIndex}\n ></WmTabheader>\n <View\n //{...this.panResponder.panHandlers}\n style={{\n width: '100%',\n //height: this.tabPaneHeights[this.state.selectedTabIndex],\n overflow: 'hidden'\n }} >\n <View style={{\n flexDirection: 'row',\n flexWrap: 'nowrap'\n }}>\n {tabPanes.map((p: any, i) => {\n return (\n <View\n key={`tab-${p.props.title}-${i}`}\n style={{width: '100%', alignSelf: 'flex-start'}}\n onLayout={this.setTabPaneHeights.bind(this, i)}>\n {/* {this.state.tabsShown[i] ? p : null} */}\n {React.cloneElement(p, { \"invokeVariables\": false })}\n {/* {p} */}\n </View>);\n })}\n </View>\n </View>\n </View>\n )\n }\n\n public renderSkeleton(props: WmTabsProps){\n if(!props.showskeletonchildren) {\n const skeletonStyles: WmSkeletonStyles = this.props?.styles?.skeleton || { root: {}, text: {} } as WmSkeletonStyles\n return createSkeleton(this.theme, skeletonStyles, {\n ...this.styles.root\n }, (<View style={[this.styles.root, { opacity: 0 }]}>\n {this.renderSkeletonContent(props)}\n </View>)) \n }\n return this.renderSkeletonContent(props);\n }\n\n public onPropertyChange(name: string, $new: any, $old: any): void {\n super.onPropertyChange(name, $new, $old);\n switch(name) {\n case \"defaultpaneindex\":\n const selectedIndex = $new || 0;\n const tabsShown: boolean[] = [];\n tabsShown[selectedIndex] = true;\n this.updateState({\n selectedTabIndex: selectedIndex,\n tabsShown: tabsShown\n } as WmTabsState);\n }\n }\n\n getBackground(): React.JSX.Element | null {\n return this._showSkeleton ? null : this._background\n } \n\n\n renderWidget(props: WmTabsProps) {\n const tabPanes = React.Children.toArray(props.children)\n .filter((item: any, index: number) => item.props.show != false);\n const headerData = tabPanes.map((p: any, i: number) =>\n ({title: p.props.title || 'Tab Title', icon: p.props.paneicon || '', key: `tab-${p.props.title}-${i}`}));\n const styles = this._showSkeleton ? {\n ...this.styles.root,\n ...this.styles.skeleton.root\n } : this.styles.root\n return (\n <View style={styles}>\n {this.getBackground()}\n <View onLayout={this.setTabLayout.bind(this)} style={{width: '100%'}}></View>\n <WmTabheader\n id={this.getTestId('headers')}\n styles={this.styles.tabHeader}\n data={headerData}\n selectedTabIndex={this.state.selectedTabIndex}\n onIndexChange={this.goToTab.bind(this)}\n ></WmTabheader>\n <View\n style={[{\n width: '100%',\n flex: 1\n }, this.styles.root.height ?\n (isWebPreviewMode() ? {'overflowX': 'hidden','overflowY': 'auto'} as any : {overflow: 'scroll'})\n : {\n overflow: 'hidden',\n maxHeight: this.tabPaneHeights[this.state.selectedTabIndex],\n }, this.styles.tabContent]} >\n <SwipeAnimation.View\n enableGestures={props.enablegestures}\n style={{\n flexDirection: 'row',\n flexWrap: 'nowrap',\n alignItems: 'flex-start'\n }}\n direction='horizontal'\n ref={(r) => {this.animationView = r}}\n handlers = {this.animationHandlers}\n >\n {tabPanes.map((p: any, i) => {\n return (\n <View\n key={`tab-${p.props.title}-${i}`}\n style={{\n width: '100%',\n height: this.styles.root.height ? undefined : 1000000,\n alignSelf: 'flex-start'}}>\n <View\n style={{width: '100%', alignSelf: 'flex-start'}}\n onLayout={this.setTabPaneHeights.bind(this, i)}>\n {/* {this.state.tabsShown[i] ? p : null} */}\n {p}\n </View>\n </View>);\n })}\n </SwipeAnimation.View>\n </View>\n </View>\n );\n }\n}\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAA6CC,IAAI,QAAQ,cAAc;AACvE,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AACjG,OAAO,KAAKC,cAAc,MAAM,oDAAoD;AACpF,SAASC,gBAAgB,QAAQ,sCAAsC;AAEvE,OAAOC,WAAW,MAAM,cAAc;AACtC,SAASC,aAAa,QAAsB,eAAe;AAE3D,OAAOC,WAAW,MAAM,iCAAiC;AAEzD,SAASC,cAAc,QAAQ,wEAAwE;AAEvG,OAAO,MAAMC,WAAW,SAASP,kBAAkB,CAAc;EAAAQ,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,oBACxC,EAAE;IAAAA,eAAA,2BACE,CAAC;EAAA;AAC9B;AAEA,eAAe,MAAMC,MAAM,SAASZ,aAAa,CAAyC;EAyBxFS,WAAWA,CAACI,KAAkB,EAAE;IAC9B,KAAK,CAACA,KAAK,EAAER,aAAa,EAAE,IAAID,WAAW,CAAC,CAAC,EAAE,IAAII,WAAW,CAAC,CAAC,CAAC;IAACG,eAAA,mBAzBlD,EAAE;IAAAA,eAAA,mBACD,CAAC;IAAAA,eA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,aAAa,GAAGwE,CAAC;MAAA,CAAE;MACrCC,QAAQ,EAAI,IAAI,CAACC;IAAkB,GAElClH,QAAQ,CAAC+D,GAAG,CAAC,CAACC,CAAM,EAAEnC,CAAC,KAAK;MAC3B,oBACAvD,KAAA,CAAA8F,aAAA,CAAC7F,IAAI;QACH4F,GAAG,EAAE,OAAOH,CAAC,CAAC3E,KAAK,CAAC4E,KAAK,IAAIpC,CAAC,EAAG;QACjCwC,KAAK,EAAE;UACLvE,KAAK,EAAE,MAAM;UACboB,MAAM,EAAE,IAAI,CAACoD,MAAM,CAACC,IAAI,CAACrD,MAAM,GAAIiG,SAAS,GAAG,OAAO;UACtDlC,SAAS,EAAE;QAAY;MAAE,gBAC3B3G,KAAA,CAAA8F,aAAA,CAAC7F,IAAI;QACH8F,KAAK,EAAE;UAACvE,KAAK,EAAE,MAAM;UAAEmF,SAAS,EAAE;QAAY,CAAE;QAChDR,QAAQ,EAAE,IAAI,CAAC3D,iBAAiB,CAAC4D,IAAI,CAAC,IAAI,EAAE7C,CAAC;MAAE,GAE9CmC,CACG,CACF,CAAC;IACT,CAAC,CACkB,CACjB,CACF,CAAC;EAEX;AACF","ignoreList":[]}
@@ -12,6 +12,7 @@ export class BaseInputState extends BaseComponentState {
12
12
  super(...args);
13
13
  _defineProperty(this, "keyboardType", 'default');
14
14
  _defineProperty(this, "isValid", true);
15
+ _defineProperty(this, "isInputFocused", false);
15
16
  _defineProperty(this, "textValue", '');
16
17
  _defineProperty(this, "isDefault", false);
17
18
  _defineProperty(this, "errorType", '');
@@ -24,6 +25,7 @@ export class BaseInputComponent extends BaseComponent {
24
25
  _defineProperty(this, "widgetRef", null);
25
26
  _defineProperty(this, "isTouched", false);
26
27
  _defineProperty(this, "cursor", 0);
28
+ _defineProperty(this, "timer", null);
27
29
  }
28
30
  focus() {
29
31
  var _this$widgetRef;
@@ -65,17 +67,40 @@ export class BaseInputComponent extends BaseComponent {
65
67
  onChange(event) {
66
68
  if (this.state.props.updateon === 'default') {
67
69
  this.updateDatavalue(event.target.value, event);
70
+ } else if (this.state.props.updateon === 'lazy') {
71
+ if (this.timer !== null) {
72
+ clearTimeout(this.timer);
73
+ this.timer = null;
74
+ }
75
+ this.timer = setTimeout(() => {
76
+ this.updateDatavalue(event.target.value, event);
77
+ }, 300);
68
78
  }
69
79
  }
70
80
  onChangeText(value) {
71
- this.updateState({
72
- textValue: value
73
- }, () => {
74
- if (this.state.props.updateon === 'default') {
75
- this.validate(value);
76
- this.updateDatavalue(value, null);
81
+ if (this.state.props.updateon === 'lazy') {
82
+ if (this.timer !== null) {
83
+ clearTimeout(this.timer);
84
+ this.timer = null;
77
85
  }
78
- });
86
+ this.timer = setTimeout(() => {
87
+ this.updateState({
88
+ textValue: value
89
+ }, () => {
90
+ this.validate(value);
91
+ this.updateDatavalue(value, null);
92
+ });
93
+ }, 300);
94
+ } else {
95
+ this.updateState({
96
+ textValue: value
97
+ }, () => {
98
+ if (this.state.props.updateon === 'default') {
99
+ this.validate(value);
100
+ this.updateDatavalue(value, null);
101
+ }
102
+ });
103
+ }
79
104
  }
80
105
  invokeChange(e) {
81
106
  if (Platform.OS === 'web') {
@@ -99,6 +124,11 @@ export class BaseInputComponent extends BaseComponent {
99
124
  new Promise(resolve => {
100
125
  if (props.hastwowaybinding) {
101
126
  this.setProp("datavalue", value);
127
+ this.updateState({
128
+ props: {
129
+ "datavalue": value
130
+ }
131
+ });
102
132
  resolve(true);
103
133
  } else {
104
134
  this.updateState({
@@ -117,7 +147,7 @@ export class BaseInputComponent extends BaseComponent {
117
147
  onBlur(event) {
118
148
  Injector.FOCUSED_ELEMENT.remove();
119
149
  this.isTouched = true;
120
- let newVal = this.state.textValue;
150
+ let newVal = this.state.textValue || '';
121
151
  let oldVal = this.state.props.datavalue || '';
122
152
  this.validate(newVal);
123
153
  if (newVal === '' || newVal == undefined) {
@@ -125,12 +155,15 @@ export class BaseInputComponent extends BaseComponent {
125
155
  this.props.triggerValidation && this.props.triggerValidation();
126
156
  }, 10);
127
157
  }
128
- if (this.state.props.updateon === 'blur') {
129
- if (oldVal !== newVal) {
158
+ if (this.state.props.updateon === 'blur' || this.state.props.updateon === 'default') {
159
+ if (oldVal !== newVal && this.state.props.updateon === 'blur') {
130
160
  this.updateDatavalue(newVal, event, 'blur');
131
161
  } else {
132
162
  this.invokeEventCallback('onBlur', [event, this.proxy]);
133
163
  }
164
+ this.setState({
165
+ isInputFocused: false
166
+ });
134
167
  }
135
168
  }
136
169
  validate(value) {
@@ -149,6 +182,9 @@ export class BaseInputComponent extends BaseComponent {
149
182
  this.invokeEventCallback('onFocus', [event, this.proxy]);
150
183
  (_this$closestTappable = this.closestTappable) === null || _this$closestTappable === void 0 || _this$closestTappable.triggerTap();
151
184
  }, 250);
185
+ this.setState({
186
+ isInputFocused: true
187
+ });
152
188
  }
153
189
  onKeyPress(event) {
154
190
  this.invokeEventCallback('onKeypress', [event, this.proxy]);
@@ -1 +1 @@
1
- {"version":3,"names":["DEFAULT_CLASS","BaseComponent","BaseComponentState","isString","Platform","validateField","Injector","BaseInputState","constructor","args","_defineProperty","BaseInputComponent","props","defaultClass","defaultProps","defaultState","focus","_this$widgetRef","widgetRef","blur","_this$widgetRef2","_this$widgetRef3","onPropertyChange","name","$new","$old","keyboardType","type","updateState","textValue","isDefault","state","onFieldChange","bind","onChange","event","updateon","updateDatavalue","target","value","onChangeText","validate","invokeChange","e","OS","cursor","selectionStart","setState","source","oldValue","datavalue","autotrim","trim","Promise","resolve","hastwowaybinding","setProp","then","invokeEventCallback","proxy","onBlur","FOCUSED_ELEMENT","remove","isTouched","newVal","oldVal","undefined","setTimeout","triggerValidation","validationObj","isValid","errorType","onFocus","_this$closestTappable","set","closestTappable","triggerTap","onKeyPress"],"sources":["baseinput.component.ts"],"sourcesContent":["import { DEFAULT_CLASS } from '@wavemaker/app-rn-runtime/components/navigation/basenav/basenav.styles';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport BaseInputProps from './baseinput.props';\nimport { isString } from 'lodash';\nimport { BaseInputStyles } from './baseinput.styles';\nimport { Platform, TextInput } from 'react-native';\nimport { validateField } from '@wavemaker/app-rn-runtime/core/utils';\nimport Injector from '@wavemaker/app-rn-runtime/core/injector';\n\nexport class BaseInputState <T extends BaseInputProps> extends BaseComponentState<T> {\n keyboardType: any = 'default';\n isValid: boolean = true;\n textValue: string = '';\n isDefault = false;\n errorType: string = '';\n}\nexport abstract class BaseInputComponent< T extends BaseInputProps, S extends BaseInputState<T>, L extends BaseInputStyles> extends BaseComponent<T, S, L> {\n public widgetRef: TextInput | null = null;\n isTouched: boolean = false;\n private cursor: any = 0;\n constructor(props: T, public defaultClass: string = DEFAULT_CLASS, defaultProps?: T, defaultState?: S) {\n super(props, defaultClass, defaultProps, defaultState);\n }\n\n focus() {\n this?.widgetRef?.focus();\n }\n\n blur() {\n this?.widgetRef?.blur && this?.widgetRef?.blur();\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'type':\n let keyboardType;\n if (this.props.type === 'number') {\n keyboardType = 'numeric';\n } else if (this.props.type === 'tel') {\n keyboardType = 'phone-pad';\n } else if (this.props.type === 'email') {\n keyboardType = 'email-address';\n }\n this.updateState({\n keyboardType: keyboardType,\n } as S);\n break;\n case 'datavalue':\n this.updateState({\n textValue: $new\n } as S\n );\n const isDefault = this.state.isDefault;\n if (isDefault) {\n this.updateState({ isDefault: false } as S, this.props.onFieldChange && this.props.onFieldChange.bind(this, 'datavalue', $new, $old, isDefault));\n } else {\n this.props.onFieldChange && this.props.onFieldChange('datavalue', $new, $old, isDefault);\n }\n }\n }\n\n onChange(event: any) {\n if (this.state.props.updateon === 'default') {\n this.updateDatavalue(event.target.value, event);\n }\n }\n\n onChangeText(value: any) {\n this.updateState({\n textValue: value\n } as S, () => {\n if (this.state.props.updateon === 'default') {\n this.validate(value);\n this.updateDatavalue(value, null);\n }\n }\n );\n }\n\n invokeChange(e: any) {\n if (Platform.OS === 'web') {\n this.cursor = e.target.selectionStart;\n this.setState({ textValue: e.target.value });\n }\n }\n\n updateDatavalue(value: any, event?: any, source?: any) {\n const props = this.state.props;\n const oldValue = props.datavalue;\n if (value === oldValue) {\n return;\n }\n\n // autotrim\n if (props.autotrim && props.datavalue && isString(props.datavalue)) {\n value = value.trim();\n }\n new Promise((resolve) => {\n if (props.hastwowaybinding) {\n this.setProp(\"datavalue\", value);\n resolve(true);\n } else {\n this.updateState({\n props: {\n datavalue: value\n }\n } as S, () => resolve(true));\n }\n }).then(() => {\n !this.props.onFieldChange && value !== oldValue && this.invokeEventCallback('onChange', [event, this.proxy, value, oldValue]);\n if (source === 'blur') {\n this.invokeEventCallback('onBlur', [ event, this.proxy]);\n }\n })\n }\n\n onBlur(event: any) {\n Injector.FOCUSED_ELEMENT.remove();\n this.isTouched = true;\n let newVal = this.state.textValue;\n let oldVal = this.state.props.datavalue || '';\n this.validate(newVal);\n if (newVal === '' || newVal == undefined) {\n setTimeout(() => {\n this.props.triggerValidation && this.props.triggerValidation();\n },10)\n }\n if (this.state.props.updateon === 'blur') {\n if (oldVal !== newVal) {\n this.updateDatavalue(newVal, event, 'blur');\n } else {\n this.invokeEventCallback('onBlur', [event, this.proxy]);\n }\n }\n }\n\n validate(value: any) {\n const validationObj = validateField(this.state.props, value);\n this.setState({\n isValid: validationObj.isValid,\n errorType: validationObj.errorType\n } as S);\n }\n\n onFocus(event: any) {\n // When input widgets are inside list widget and try to focus the field, list is selecting but unable to enter values in input fields\n // because on tap event of list is triggering after 200ms timeout So added 250ms timeout here\n setTimeout(() => {\n Injector.FOCUSED_ELEMENT.set(this);\n this.invokeEventCallback('onFocus', [ event, this.proxy]);\n this.closestTappable?.triggerTap();\n }, 250);\n\n }\n\n onKeyPress(event: any) {\n this.invokeEventCallback('onKeypress', [ event, this.proxy]);\n }\n}\n"],"mappings":";;;AAAA,SAASA,aAAa,QAAQ,wEAAwE;AACtG,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AAEjG,SA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;EAEAlB,QAAQA,CAACF,KAAU,EAAE;IACnB,MAAM8B,aAAa,GAAGhE,aAAa,CAAC,IAAI,CAAC0B,KAAK,CAACnB,KAAK,EAAE2B,KAAK,CAAC;IAC5D,IAAI,CAACQ,QAAQ,CAAC;MACZuB,OAAO,EAAED,aAAa,CAACC,OAAO;MAC9BC,SAAS,EAAEF,aAAa,CAACE;IAC3B,CAAM,CAAC;EACT;EAEAC,OAAOA,CAACrC,KAAU,EAAE;IAClB;IACA;IACAgC,UAAU,CAAC,MAAM;MAAA,IAAAM,qBAAA;MACfnE,QAAQ,CAACuD,eAAe,CAACa,GAAG,CAAC,IAAI,CAAC;MAClC,IAAI,CAAChB,mBAAmB,CAAC,SAAS,EAAE,CAAEvB,KAAK,EAAE,IAAI,CAACwB,KAAK,CAAC,CAAC;MACzD,CAAAc,qBAAA,OAAI,CAACE,eAAe,cAAAF,qBAAA,eAApBA,qBAAA,CAAsBG,UAAU,CAAC,CAAC;IACpC,CAAC,EAAE,GAAG,CAAC;EAET;EAEAC,UAAUA,CAAC1C,KAAU,EAAE;IACrB,IAAI,CAACuB,mBAAmB,CAAC,YAAY,EAAE,CAAEvB,KAAK,EAAE,IAAI,CAACwB,KAAK,CAAC,CAAC;EAC9D;AACF","ignoreList":[]}
1
+ {"version":3,"names":["DEFAULT_CLASS","BaseComponent","BaseComponentState","isString","Platform","validateField","Injector","BaseInputState","constructor","args","_defineProperty","BaseInputComponent","props","defaultClass","defaultProps","defaultState","focus","_this$widgetRef","widgetRef","blur","_this$widgetRef2","_this$widgetRef3","onPropertyChange","name","$new","$old","keyboardType","type","updateState","textValue","isDefault","state","onFieldChange","bind","onChange","event","updateon","updateDatavalue","target","value","timer","clearTimeout","setTimeout","onChangeText","validate","invokeChange","e","OS","cursor","selectionStart","setState","source","oldValue","datavalue","autotrim","trim","Promise","resolve","hastwowaybinding","setProp","then","invokeEventCallback","proxy","onBlur","FOCUSED_ELEMENT","remove","isTouched","newVal","oldVal","undefined","triggerValidation","isInputFocused","validationObj","isValid","errorType","onFocus","_this$closestTappable","set","closestTappable","triggerTap","onKeyPress"],"sources":["baseinput.component.ts"],"sourcesContent":["import { DEFAULT_CLASS } from '@wavemaker/app-rn-runtime/components/navigation/basenav/basenav.styles';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport BaseInputProps from './baseinput.props';\nimport { isString } from 'lodash';\nimport { BaseInputStyles } from './baseinput.styles';\nimport { Platform, TextInput } from 'react-native';\nimport { validateField } from '@wavemaker/app-rn-runtime/core/utils';\nimport Injector from '@wavemaker/app-rn-runtime/core/injector';\n\nexport class BaseInputState <T extends BaseInputProps> extends BaseComponentState<T> {\n keyboardType: any = 'default';\n isValid: boolean = true;\n isInputFocused: boolean = false;\n textValue: string = '';\n isDefault = false;\n errorType: string = '';\n}\nexport abstract class BaseInputComponent< T extends BaseInputProps, S extends BaseInputState<T>, L extends BaseInputStyles> extends BaseComponent<T, S, L> {\n public widgetRef: TextInput | null = null;\n isTouched: boolean = false;\n private cursor: any = 0;\n private timer: ReturnType<typeof setTimeout> | null = null;\n constructor(props: T, public defaultClass: string = DEFAULT_CLASS, defaultProps?: T, defaultState?: S) {\n super(props, defaultClass, defaultProps, defaultState);\n }\n\n focus() {\n this?.widgetRef?.focus();\n }\n\n blur() {\n this?.widgetRef?.blur && this?.widgetRef?.blur();\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'type':\n let keyboardType;\n if (this.props.type === 'number') {\n keyboardType = 'numeric';\n } else if (this.props.type === 'tel') {\n keyboardType = 'phone-pad';\n } else if (this.props.type === 'email') {\n keyboardType = 'email-address';\n }\n this.updateState({\n keyboardType: keyboardType,\n } as S);\n break;\n case 'datavalue':\n this.updateState({\n textValue: $new\n } as S\n );\n const isDefault = this.state.isDefault;\n if (isDefault) {\n this.updateState({ isDefault: false } as S, this.props.onFieldChange && this.props.onFieldChange.bind(this, 'datavalue', $new, $old, isDefault));\n } else {\n this.props.onFieldChange && this.props.onFieldChange('datavalue', $new, $old, isDefault);\n }\n }\n }\n\n onChange(event: any) {\n if (this.state.props.updateon === 'default') {\n this.updateDatavalue(event.target.value, event);\n }else if(this.state.props.updateon === 'lazy') {\n if(this.timer !== null) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n\n this.timer = setTimeout(() => {\n this.updateDatavalue(event.target.value, event);\n }, 300)\n }\n }\n\n onChangeText(value: any) {\n if(this.state.props.updateon === 'lazy') {\n if(this.timer !== null) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n\n this.timer = setTimeout(() => {\n this.updateState({\n textValue: value\n } as S, () => {\n this.validate(value);\n this.updateDatavalue(value, null);\n }\n );\n }, 300)\n }\n else {\n this.updateState({\n textValue: value\n } as S, () => {\n if (this.state.props.updateon === 'default') {\n this.validate(value);\n this.updateDatavalue(value, null);\n }\n }\n );\n }\n }\n\n invokeChange(e: any) {\n if (Platform.OS === 'web') {\n this.cursor = e.target.selectionStart;\n this.setState({ textValue: e.target.value });\n }\n }\n\n updateDatavalue(value: any, event?: any, source?: any) {\n const props = this.state.props;\n const oldValue = props.datavalue;\n if (value === oldValue) {\n return;\n }\n\n // autotrim\n if (props.autotrim && props.datavalue && isString(props.datavalue)) {\n value = value.trim();\n }\n new Promise((resolve) => {\n if (props.hastwowaybinding) {\n this.setProp(\"datavalue\", value);\n this.updateState({props: { \"datavalue\": value }} as S);\n resolve(true);\n } else {\n this.updateState({\n props: {\n datavalue: value\n }\n } as S, () => resolve(true));\n }\n }).then(() => {\n !this.props.onFieldChange && value !== oldValue && this.invokeEventCallback('onChange', [event, this.proxy, value, oldValue]);\n if (source === 'blur') {\n this.invokeEventCallback('onBlur', [ event, this.proxy]);\n }\n })\n }\n\n onBlur(event: any) {\n Injector.FOCUSED_ELEMENT.remove();\n this.isTouched = true;\n let newVal = this.state.textValue || '';\n let oldVal = this.state.props.datavalue || '';\n this.validate(newVal);\n if (newVal === '' || newVal == undefined) {\n setTimeout(() => {\n this.props.triggerValidation && this.props.triggerValidation();\n },10)\n }\n if (this.state.props.updateon === 'blur' || this.state.props.updateon === 'default') {\n if (oldVal !== newVal && this.state.props.updateon === 'blur') {\n this.updateDatavalue(newVal, event, 'blur');\n } else {\n this.invokeEventCallback('onBlur', [event, this.proxy]);\n }\n this.setState({ isInputFocused: false })\n }\n }\n\n validate(value: any) {\n const validationObj = validateField(this.state.props, value);\n this.setState({\n isValid: validationObj.isValid,\n errorType: validationObj.errorType\n } as S);\n }\n\n onFocus(event: any) {\n // When input widgets are inside list widget and try to focus the field, list is selecting but unable to enter values in input fields\n // because on tap event of list is triggering after 200ms timeout So added 250ms timeout here\n setTimeout(() => {\n Injector.FOCUSED_ELEMENT.set(this);\n this.invokeEventCallback('onFocus', [ event, this.proxy]);\n this.closestTappable?.triggerTap();\n }, 250);\n this.setState({ isInputFocused: true })\n }\n\n onKeyPress(event: any) {\n this.invokeEventCallback('onKeypress', [ event, this.proxy]);\n }\n}\n"],"mappings":";;;AAAA,SAASA,aAAa,QAAQ,wEAAwE;AACtG,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AAEjG,SAASC,QAAQ,QAAQ,QAAQ;AAEjC,SAASC,QAAQ,QAAmB,cAAc;AAClD,SAASC,aAAa,QAAQ,sCAAsC;AACpE,OAAOC,QAAQ,MAAM,yCAAyC;AAE9D,OAAO,MAAMC,cAAc,SAAoCL,kBAAkB,CAAI;EAAAM,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,uBAC/D,SAAS;IAAAA,eAAA,kBACV,IAAI;IAAAA,eAAA,yBACG,KAAK;IAAAA,eAAA,oBACX,EAAE;IAAAA,eAAA,oBACV,KAAK;IAAAA,eAAA,oBACG,EAAE;EAAA;AACxB;AACA,OAAO,MAAeC,kBAAkB,SAA4FV,aAAa,CAAU;EAKzJO,WAAWA,CAACI,KAAQ,EAASC,YAAoB,GAAGb,aAAa,EAAEc,YAAgB,EAAEC,YAAgB,EAAE;IACrG,KAAK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D,CAAAc,qBAAA,OAAI,CAACE,eAAe,cAAAF,qBAAA,eAApBA,qBAAA,CAAsBG,UAAU,CAAC,CAAC;IACpC,CAAC,EAAE,GAAG,CAAC;IACP,IAAI,CAAC7B,QAAQ,CAAC;MAAEqB,cAAc,EAAE;IAAK,CAAC,CAAC;EACzC;EAEAS,UAAUA,CAAC7C,KAAU,EAAE;IACrB,IAAI,CAAC0B,mBAAmB,CAAC,YAAY,EAAE,CAAE1B,KAAK,EAAE,IAAI,CAAC2B,KAAK,CAAC,CAAC;EAC9D;AACF","ignoreList":[]}
@@ -10,6 +10,7 @@ export class BaseNumberState extends BaseComponentState {
10
10
  constructor(...args) {
11
11
  super(...args);
12
12
  _defineProperty(this, "isValid", true);
13
+ _defineProperty(this, "isInputFocused", false);
13
14
  _defineProperty(this, "textValue", '');
14
15
  _defineProperty(this, "isDefault", false);
15
16
  _defineProperty(this, "errorType", '');
@@ -159,6 +160,11 @@ export class BaseNumberComponent extends BaseComponent {
159
160
  new Promise(resolve => {
160
161
  if (props.hastwowaybinding) {
161
162
  this.setProp("datavalue", value);
163
+ this.updateState({
164
+ props: {
165
+ "datavalue": value
166
+ }
167
+ });
162
168
  resolve(true);
163
169
  } else {
164
170
  this.updateState({
@@ -175,24 +181,31 @@ export class BaseNumberComponent extends BaseComponent {
175
181
  });
176
182
  }
177
183
  onBlur(event, isDisplayValuePresent) {
178
- let newVal = isDisplayValuePresent ? this.state.textValue : event.target.value || this.state.textValue;
184
+ const textVal = this.state.textValue || '';
185
+ let newVal = isDisplayValuePresent ? textVal : event.target.value || textVal;
179
186
  this.validate(newVal);
180
187
  if (newVal === '' || newVal == undefined) {
181
188
  setTimeout(() => {
182
189
  this.props.triggerValidation && this.props.triggerValidation();
183
190
  }, 10);
184
191
  }
185
- if (this.state.props.updateon === 'blur') {
192
+ if (this.state.props.updateon === 'blur' || this.state.props.updateon === 'default') {
186
193
  let oldVal = this.state.props.datavalue || '';
187
- if (oldVal !== newVal) {
194
+ if (oldVal !== newVal && this.state.props.updateon === 'blur') {
188
195
  this.updateDatavalue(newVal, event, 'blur');
189
196
  } else {
190
197
  this.invokeEventCallback('onBlur', [event, this.proxy]);
191
198
  }
199
+ this.setState({
200
+ isInputFocused: false
201
+ });
192
202
  }
193
203
  }
194
204
  onFocus(event) {
195
205
  this.invokeEventCallback('onFocus', [event, this.proxy]);
206
+ this.setState({
207
+ isInputFocused: true
208
+ });
196
209
  }
197
210
 
198
211
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["includes","intersection","isNaN","isFinite","toArray","isNil","BaseComponent","BaseComponentState","DEFAULT_CLASS","Platform","countDecimalDigits","validateField","BaseNumberState","constructor","args","_defineProperty","BaseNumberComponent","props","defaultClass","defaultProps","defaultState","DECIMAL","GROUP","onChange","event","state","updateon","updateDatavalue","target","value","focus","_this$widgetRef","widgetRef","validateOnDevice","type","_value$match","isCurrencyField","isValidText","test","Number","match","length","onChangeText","shouldFormateToNumber","newValue","parseNumber","replace","isValidTextOnDevice","decimalPlacesInNumber","decimalPlaces","updateState","textValue","validate","invokeChange","e","OS","cursor","selectionStart","setState","validationObj","isValid","errorType","handleValidation","regexp","condition","RegExp","val","parts","split","NaN","number","join","decimal","sum","parseFloat","toFixed","Object","is","source","model","toString","oldValue","datavalue","validNumber","isValidNumber","invokeEventCallback","proxy","Promise","resolve","hastwowaybinding","setProp","then","onFieldChange","onBlur","isDisplayValuePresent","newVal","undefined","setTimeout","triggerValidation","oldVal","onFocus","countDecimals","decimalValue","validateInputEntry","$event","ctrlKey","key","validity","inputValue","step","preventDefault","getValueInRange","minvalue","maxvalue","required","isInteger","resetValidations","onPropertyChange","name","$new","$old","isDefault","bind","displayValue"],"sources":["basenumber.component.ts"],"sourcesContent":["import { includes, intersection, isNaN, isFinite, toArray, isNil } from 'lodash';\nimport BaseNumberProps from '@wavemaker/app-rn-runtime/components/input/basenumber/basenumber.props';\nimport { BaseComponent, BaseComponentState } from \"@wavemaker/app-rn-runtime/core/base.component\";\nimport { BaseNumberStyles } from '@wavemaker/app-rn-runtime/components/input/basenumber/basenumber.styles';\nimport { DEFAULT_CLASS } from \"@wavemaker/app-rn-runtime/components/navigation/basenav/basenav.styles\";\nimport { Platform, TextInput } from 'react-native';\nimport { countDecimalDigits, validateField } from '@wavemaker/app-rn-runtime/core/utils';\n\nexport class BaseNumberState <T extends BaseNumberProps> extends BaseComponentState<T> {\n isValid: boolean = true;\n textValue: string = '';\n isDefault = false;\n errorType = '';\n}\n\nexport abstract class BaseNumberComponent< T extends BaseNumberProps, S extends BaseNumberState<T>, L extends BaseNumberStyles> extends BaseComponent<T, S, L> {\n private DECIMAL;\n private GROUP;\n public widgetRef: TextInput | null = null;\n private cursor: any = 0;\n constructor(props: T, public defaultClass: string = DEFAULT_CLASS, defaultProps?: T, defaultState?: S) {\n super(props, defaultClass, defaultProps, defaultState);\n this.DECIMAL = '.';\n this.GROUP = ',';\n }\n\n onChange(event: any) {\n if (this.state.props.updateon === 'default') {\n this.updateDatavalue(event.target.value, event);\n }\n }\n\n focus() {\n this?.widgetRef?.focus();\n }\n\n validateOnDevice(value: string, type: 'number' | 'currency') {\n const isCurrencyField = type === 'currency';\n let isValidText = true;\n\n // * no alphabets except E, may contain E only once\n if (/[a-df-zA-DF-Z]/.test(value) || !/^[^eE]*[eE]?[^eE]*$/.test(value)) {\n isValidText = false;\n }\n\n // * currency only: check for negative number\n if (isCurrencyField && (Number(value) < 0 || /-/g.test(value))) {\n isValidText = false;\n }\n\n // * number only: not more than one minus and doesn't end with minus (-)\n if (!isCurrencyField && (Number(value.match(/-/g)?.length) > 1) || /\\w-/.test(value)) {\n isValidText = false;\n }\n\n // * check for more than one decimal point\n if (/^\\d*\\.\\d*\\..*$/.test(value)) {\n isValidText = false;\n }\n\n // * check for spaces and comma\n if (/[\\s,]/.test(value)) {\n isValidText = false;\n }\n\n return isValidText;\n }\n\n onChangeText(value: string, type: 'number' | 'currency', shouldFormateToNumber?: boolean) {\n const newValue = shouldFormateToNumber ? `${this.parseNumber(value.replace(/[^0-9.]/g, ''))}` : value;\n const isValidTextOnDevice = this.validateOnDevice(newValue, type);\n if (!isValidTextOnDevice) {\n return;\n }\n\n const decimalPlacesInNumber = countDecimalDigits(newValue);\n\n if (this.props.decimalPlaces < decimalPlacesInNumber) {\n return;\n }\n\n this.updateState({\n textValue: newValue\n } as S, () => {\n if (this.state.props.updateon === 'default') {\n this.validate(newValue);\n this.updateDatavalue(newValue, null);\n }\n }\n );\n }\n\n invokeChange(e: any) {\n if (Platform.OS === 'web') {\n this.cursor = e.target.selectionStart;\n this.setState({ textValue: e.target.value });\n }\n }\n\n validate(value: any) {\n const validationObj = validateField(this.state.props, value);\n this.updateState({\n isValid: validationObj.isValid,\n errorType: validationObj.errorType\n } as S);\n\n }\n\n handleValidation(value: any) {\n const props = this.state.props;\n if (props.regexp) {\n const condition = new RegExp(props.regexp, 'g');\n return condition.test(value);\n }\n return true;\n }\n\n /**\n * Method parses the Localized number(string) to a valid number.\n * if the string dose not result to a valid number then returns NaN.\n * @param {string} val Localized number.\n * @returns {number}\n */\n private parseNumber(val: string): any {\n // splits string into two parts. decimal and number.\n const parts = val.split(this.DECIMAL);\n if (!parts.length) {\n return;\n }\n if (parts.length > 2) {\n return NaN;\n }\n // If number have decimal point and not have a decimal value then return.\n if (parts[1] === '') {\n return NaN;\n }\n // replaces all group separators form the number.\n const number = Number(parts[0].split(this.GROUP).join(''));\n const decimal = Number(`0.${parts[1] || 0}`);\n if (Number.isNaN(number) || Number.isNaN(decimal)) {\n return NaN;\n }\n const sum = parts.length > 1 ? parseFloat((number + decimal).toFixed(parts[1].length)) : number + decimal;\n // if the number is negative then calculate the number as number - decimal\n // Ex: number = -123 and decimal = 0.45 then number - decimal = -123-045 = -123.45\n // If entered number is -0.1 to -0.9 then the number is -0 and decimal is 0.1 to 0.9. Now calaculate the number as number-decimal\n // Ex: number = -0 and decimal = 0.1 then number-decimal = -0-0.1 = -0.1\n if (number === 0) {\n return Object.is(0, number) ? sum : number - decimal;\n }\n return number > 0 ? sum : number - decimal;\n }\n\n updateDatavalue(value: any, event?: any, source?: any) {\n const model = value && this.parseNumber(value.toString());\n const props = this.state.props;\n const oldValue = props.datavalue;\n if (value === oldValue) {\n return;\n }\n const validNumber = this.isValidNumber(model) || value == oldValue + '.';\n if (!validNumber) {\n this.invokeEventCallback('onError', [ event, this.proxy, value, oldValue ]);\n return;\n }\n\n new Promise((resolve) => {\n if (props.hastwowaybinding) {\n this.setProp(\"datavalue\", value);\n resolve(true);\n } else {\n this.updateState({\n props: {\n datavalue: model || Number(value)\n }\n } as S, () => resolve(true));\n }\n }).then(() => {\n !this.props.onFieldChange && value !== oldValue && this.invokeEventCallback('onChange', [event, this.proxy, model, oldValue]);\n if (source === 'blur') {\n this.invokeEventCallback('onBlur', [event, this.proxy]);\n }\n });\n }\n\n onBlur(event: any, isDisplayValuePresent?: boolean) {\n let newVal = isDisplayValuePresent ? this.state.textValue : event.target.value || this.state.textValue;\n this.validate(newVal);\n if (newVal === '' || newVal == undefined) {\n setTimeout(() => {\n this.props.triggerValidation && this.props.triggerValidation();\n },10)\n }\n if (this.state.props.updateon === 'blur') {\n let oldVal = this.state.props.datavalue || '';\n if (oldVal !== newVal) {\n this.updateDatavalue(newVal, event, 'blur');\n } else {\n this.invokeEventCallback('onBlur', [event, this.proxy]);\n }\n }\n }\n\n onFocus(event: any) {\n this.invokeEventCallback('onFocus', [ event, this.proxy]);\n }\n\n /**\n * returns the number of decimal places a number have.\n * @param value: number\n * @returns {number}\n */\n private countDecimals(value: any) {\n if (value && ((value % 1) !== 0)) {\n const decimalValue = value.toString().split('.')[1];\n return decimalValue && decimalValue.length;\n }\n return 0;\n }\n\n public validateInputEntry($event: any) {\n const props = this.state.props;\n\n // allow actions if control key is pressed or if backspace is pressed. (for Mozilla).\n if ($event.ctrlKey || includes(['Backspace', 'ArrowRight', 'ArrowLeft', 'Tab', 'Enter', 'Delete'], $event.key)) {\n return;\n }\n\n const validity = new RegExp(`^[\\\\d\\\\s-,.e+${this.GROUP}${this.DECIMAL}]$`, 'i');\n const inputValue = $event.target.value;\n // validates entering of decimal values only when user provides decimal limit(i.e step contains decimal values).\n if (inputValue && this.countDecimals(props.step) && (this.countDecimals(inputValue) >= this.countDecimals(props.step))) {\n $event.preventDefault();\n }\n // validates if user entered an invalid character.\n if (!validity.test($event.key)) {\n $event.preventDefault();\n }\n // a decimal value can be entered only once in the input.\n if (includes(inputValue, this.DECIMAL) && $event.key === this.DECIMAL) {\n $event.preventDefault();\n }\n // 'e' can be entered only once in the input.\n if (intersection(toArray(inputValue), ['e', 'E']).length && includes('eE', $event.key)) {\n $event.preventDefault();\n }\n if ((includes(inputValue, '+') || includes(inputValue, '-')) && ($event.key === '+' || $event.key === '-')) {\n $event.preventDefault();\n }\n this.invokeEventCallback('onKeypress', [ $event, this.proxy]);\n }\n\n /**\n * returns a valid number by validating the minimum and maximum values.\n * @param {number} value\n * @returns {number}\n */\n private getValueInRange(value: number): number {\n const props = this.state.props;\n if (!isNil(value) && !isNaN(props.minvalue) && value < props.minvalue) {\n this.updateState({ errorType: 'minvalue'} as S);\n return props.minvalue;\n }\n if (!isNil(value) && !isNaN(props.maxvalue) && value > props.maxvalue) {\n this.updateState({ errorType: 'maxvalue'} as S);\n return props.maxvalue;\n }\n return value;\n }\n\n /**\n * Adds validations for the number before updating the widget model. like validating min and max value for the widget.\n * @param {number} val number to be validated\n * @returns {number}\n */\n private isValidNumber(val: number): boolean {\n const props = this.state.props;\n\n //empty number widget should not show validation error when required is false\n // @ts-ignore\n if (this.state.props.required === false && val === '') {\n return true;\n }\n // id number is infinite then consider it as invalid value\n if (isNaN(val) || !isFinite(val) || (!Number.isInteger(props.step) &&\n this.countDecimals(val) > this.countDecimals(props.step))) {\n this.updateState({\n isValid: false,\n } as S);\n return false;\n }\n if (val !== this.getValueInRange(val)) {\n this.updateState({\n isValid: false,\n } as S);\n return true;\n }\n this.resetValidations();\n return true;\n }\n\n // resets all the flags related to the widget's validation.\n protected resetValidations() {\n this.updateState({\n isValid: true,\n } as S);\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'minvalue':\n case 'maxvalue':\n if ($new|| $old) {\n this.isValidNumber($new);\n }\n break;\n case 'datavalue':\n this.updateState({\n textValue: $new,\n } as S);\n const isDefault = this.state.isDefault;\n if (isDefault) {\n this.updateState({ isDefault: false } as S, this.props.onFieldChange && this.props.onFieldChange.bind(this, 'datavalue', $new, $old, isDefault));\n } else {\n this.props.onFieldChange && this.props.onFieldChange('datavalue', $new, $old, isDefault);\n }\n break;\n case 'displayValue': \n this.updateState({\n displayValue: $new,\n } as any)\n }\n }\n}\n"],"mappings":";;;AAAA,SAASA,QAAQ,EAAEC,YAAY,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,KAAK,QAAQ,QAAQ;AAEhF,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AAEjG,SAASC,aAAa,QAAQ,wEAAwE;AACtG,SAASC,QAAQ,QAAmB,cAAc;AAClD,SAASC,kBAAkB,EAAEC,aAAa,QAAQ,sCAAsC;AAExF,OAAO,MAAMC,eAAe,SAAqCL,kBAAkB,CAAI;EAAAM,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,kBAClE,IAAI;IAAAA,eAAA,oBACH,EAAE;IAAAA,eAAA,oBACV,KAAK;IAAAA,eAAA,oBACL,EAAE;EAAA;AAChB;AAEA,OAAO,MAAeC,mBAAmB,SAA+FV,aAAa,CAAU;EAK7JO,WAAWA,CAACI,KAAQ,EAASC,YAAoB,GAAGV,aAAa,EAAEW,YAAgB,EAAEC,YAAgB,EAAE;IACrG,KAAK,CAACH,KAAK,EAAEC,YAAY,EAAEC,YAAY,EAAEC,YAAY,CAAC;IAAC,KAD5BF,YAAoB,GAApBA,YAAoB;IAAAH,eAAA;IAAAA,eAAA;IAAAA,eAAA,oBAFZ,IAAI;IAAAA,eAAA,iBACnB,CAAC;IAGrB,IAAI,CAAC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AgBA,CAAA,EAAG;IAC3B,IAAI,CAAClE,WAAW,CAAC;MACfU,OAAO,EAAE;IACX,CAAM,CAAC;EACT;EAEAyD,gBAAgBA,CAACC,IAAY,EAAEC,IAAS,EAAEC,IAAS,EAAE;IACnD,QAAQF,IAAI;MACV,KAAK,UAAU;MACf,KAAK,UAAU;QACb,IAAIC,IAAI,IAAGC,IAAI,EAAE;UACf,IAAI,CAACpC,aAAa,CAACmC,IAAI,CAAC;QAC1B;QACA;MACF,KAAK,WAAW;QACd,IAAI,CAACrE,WAAW,CAAC;UACfC,SAAS,EAAEoE;QACb,CAAM,CAAC;QACP,MAAME,SAAS,GAAG,IAAI,CAAChG,KAAK,CAACgG,SAAS;QACtC,IAAIA,SAAS,EAAE;UACb,IAAI,CAACvE,WAAW,CAAC;YAAEuE,SAAS,EAAE;UAAM,CAAC,EAAO,IAAI,CAACxG,KAAK,CAAC2E,aAAa,IAAI,IAAI,CAAC3E,KAAK,CAAC2E,aAAa,CAAC8B,IAAI,CAAC,IAAI,EAAE,WAAW,EAAEH,IAAI,EAAEC,IAAI,EAAEC,SAAS,CAAC,CAAC;QAClJ,CAAC,MAAM;UACL,IAAI,CAACxG,KAAK,CAAC2E,aAAa,IAAI,IAAI,CAAC3E,KAAK,CAAC2E,aAAa,CAAC,WAAW,EAAE2B,IAAI,EAAEC,IAAI,EAAEC,SAAS,CAAC;QAC1F;QACA;MACF,KAAK,cAAc;QACjB,IAAI,CAACvE,WAAW,CAAC;UACfyE,YAAY,EAAEJ;QAChB,CAAQ,CAAC;IACb;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"names":["includes","intersection","isNaN","isFinite","toArray","isNil","BaseComponent","BaseComponentState","DEFAULT_CLASS","Platform","countDecimalDigits","validateField","BaseNumberState","constructor","args","_defineProperty","BaseNumberComponent","props","defaultClass","defaultProps","defaultState","DECIMAL","GROUP","onChange","event","state","updateon","updateDatavalue","target","value","focus","_this$widgetRef","widgetRef","validateOnDevice","type","_value$match","isCurrencyField","isValidText","test","Number","match","length","onChangeText","shouldFormateToNumber","newValue","parseNumber","replace","isValidTextOnDevice","decimalPlacesInNumber","decimalPlaces","updateState","textValue","validate","invokeChange","e","OS","cursor","selectionStart","setState","validationObj","isValid","errorType","handleValidation","regexp","condition","RegExp","val","parts","split","NaN","number","join","decimal","sum","parseFloat","toFixed","Object","is","source","model","toString","oldValue","datavalue","validNumber","isValidNumber","invokeEventCallback","proxy","Promise","resolve","hastwowaybinding","setProp","then","onFieldChange","onBlur","isDisplayValuePresent","textVal","newVal","undefined","setTimeout","triggerValidation","oldVal","isInputFocused","onFocus","countDecimals","decimalValue","validateInputEntry","$event","ctrlKey","key","validity","inputValue","step","preventDefault","getValueInRange","minvalue","maxvalue","required","isInteger","resetValidations","onPropertyChange","name","$new","$old","isDefault","bind","displayValue"],"sources":["basenumber.component.ts"],"sourcesContent":["import { includes, intersection, isNaN, isFinite, toArray, isNil } from 'lodash';\nimport BaseNumberProps from '@wavemaker/app-rn-runtime/components/input/basenumber/basenumber.props';\nimport { BaseComponent, BaseComponentState } from \"@wavemaker/app-rn-runtime/core/base.component\";\nimport { BaseNumberStyles } from '@wavemaker/app-rn-runtime/components/input/basenumber/basenumber.styles';\nimport { DEFAULT_CLASS } from \"@wavemaker/app-rn-runtime/components/navigation/basenav/basenav.styles\";\nimport { Platform, TextInput } from 'react-native';\nimport { countDecimalDigits, validateField } from '@wavemaker/app-rn-runtime/core/utils';\n\nexport class BaseNumberState <T extends BaseNumberProps> extends BaseComponentState<T> {\n isValid: boolean = true;\n isInputFocused: boolean = false;\n textValue: string = '';\n isDefault = false;\n errorType = '';\n}\n\nexport abstract class BaseNumberComponent< T extends BaseNumberProps, S extends BaseNumberState<T>, L extends BaseNumberStyles> extends BaseComponent<T, S, L> {\n private DECIMAL;\n private GROUP;\n public widgetRef: TextInput | null = null;\n private cursor: any = 0;\n constructor(props: T, public defaultClass: string = DEFAULT_CLASS, defaultProps?: T, defaultState?: S) {\n super(props, defaultClass, defaultProps, defaultState);\n this.DECIMAL = '.';\n this.GROUP = ',';\n }\n\n onChange(event: any) {\n if (this.state.props.updateon === 'default') {\n this.updateDatavalue(event.target.value, event);\n }\n }\n\n focus() {\n this?.widgetRef?.focus();\n }\n\n validateOnDevice(value: string, type: 'number' | 'currency') {\n const isCurrencyField = type === 'currency';\n let isValidText = true;\n\n // * no alphabets except E, may contain E only once\n if (/[a-df-zA-DF-Z]/.test(value) || !/^[^eE]*[eE]?[^eE]*$/.test(value)) {\n isValidText = false;\n }\n\n // * currency only: check for negative number\n if (isCurrencyField && (Number(value) < 0 || /-/g.test(value))) {\n isValidText = false;\n }\n\n // * number only: not more than one minus and doesn't end with minus (-)\n if (!isCurrencyField && (Number(value.match(/-/g)?.length) > 1) || /\\w-/.test(value)) {\n isValidText = false;\n }\n\n // * check for more than one decimal point\n if (/^\\d*\\.\\d*\\..*$/.test(value)) {\n isValidText = false;\n }\n\n // * check for spaces and comma\n if (/[\\s,]/.test(value)) {\n isValidText = false;\n }\n\n return isValidText;\n }\n\n onChangeText(value: string, type: 'number' | 'currency', shouldFormateToNumber?: boolean) {\n const newValue = shouldFormateToNumber ? `${this.parseNumber(value.replace(/[^0-9.]/g, ''))}` : value;\n const isValidTextOnDevice = this.validateOnDevice(newValue, type);\n if (!isValidTextOnDevice) {\n return;\n }\n\n const decimalPlacesInNumber = countDecimalDigits(newValue);\n\n if (this.props.decimalPlaces < decimalPlacesInNumber) {\n return;\n }\n\n this.updateState({\n textValue: newValue\n } as S, () => {\n if (this.state.props.updateon === 'default') {\n this.validate(newValue);\n this.updateDatavalue(newValue, null);\n }\n }\n );\n }\n\n invokeChange(e: any) {\n if (Platform.OS === 'web') {\n this.cursor = e.target.selectionStart;\n this.setState({ textValue: e.target.value });\n }\n }\n\n validate(value: any) {\n const validationObj = validateField(this.state.props, value);\n this.updateState({\n isValid: validationObj.isValid,\n errorType: validationObj.errorType\n } as S);\n\n }\n\n handleValidation(value: any) {\n const props = this.state.props;\n if (props.regexp) {\n const condition = new RegExp(props.regexp, 'g');\n return condition.test(value);\n }\n return true;\n }\n\n /**\n * Method parses the Localized number(string) to a valid number.\n * if the string dose not result to a valid number then returns NaN.\n * @param {string} val Localized number.\n * @returns {number}\n */\n private parseNumber(val: string): any {\n // splits string into two parts. decimal and number.\n const parts = val.split(this.DECIMAL);\n if (!parts.length) {\n return;\n }\n if (parts.length > 2) {\n return NaN;\n }\n // If number have decimal point and not have a decimal value then return.\n if (parts[1] === '') {\n return NaN;\n }\n // replaces all group separators form the number.\n const number = Number(parts[0].split(this.GROUP).join(''));\n const decimal = Number(`0.${parts[1] || 0}`);\n if (Number.isNaN(number) || Number.isNaN(decimal)) {\n return NaN;\n }\n const sum = parts.length > 1 ? parseFloat((number + decimal).toFixed(parts[1].length)) : number + decimal;\n // if the number is negative then calculate the number as number - decimal\n // Ex: number = -123 and decimal = 0.45 then number - decimal = -123-045 = -123.45\n // If entered number is -0.1 to -0.9 then the number is -0 and decimal is 0.1 to 0.9. Now calaculate the number as number-decimal\n // Ex: number = -0 and decimal = 0.1 then number-decimal = -0-0.1 = -0.1\n if (number === 0) {\n return Object.is(0, number) ? sum : number - decimal;\n }\n return number > 0 ? sum : number - decimal;\n }\n\n updateDatavalue(value: any, event?: any, source?: any) {\n const model = value && this.parseNumber(value.toString());\n const props = this.state.props;\n const oldValue = props.datavalue;\n if (value === oldValue) {\n return;\n }\n const validNumber = this.isValidNumber(model) || value == oldValue + '.';\n if (!validNumber) {\n this.invokeEventCallback('onError', [ event, this.proxy, value, oldValue ]);\n return;\n }\n\n new Promise((resolve) => {\n if (props.hastwowaybinding) {\n this.setProp(\"datavalue\", value);\n this.updateState({props: { \"datavalue\": value }} as S);\n resolve(true);\n } else {\n this.updateState({\n props: {\n datavalue: model || Number(value)\n }\n } as S, () => resolve(true));\n }\n }).then(() => {\n !this.props.onFieldChange && value !== oldValue && this.invokeEventCallback('onChange', [event, this.proxy, model, oldValue]);\n if (source === 'blur') {\n this.invokeEventCallback('onBlur', [event, this.proxy]);\n }\n });\n }\n\n onBlur(event: any, isDisplayValuePresent?: boolean) {\n const textVal = this.state.textValue || '';\n let newVal = isDisplayValuePresent ? textVal : event.target.value || textVal;\n this.validate(newVal);\n if (newVal === '' || newVal == undefined) {\n setTimeout(() => {\n this.props.triggerValidation && this.props.triggerValidation();\n },10)\n }\n if (this.state.props.updateon === 'blur' || this.state.props.updateon === 'default') {\n let oldVal = this.state.props.datavalue || '';\n if (oldVal !== newVal && this.state.props.updateon === 'blur') {\n this.updateDatavalue(newVal, event, 'blur');\n } else {\n this.invokeEventCallback('onBlur', [event, this.proxy]);\n }\n this.setState({ isInputFocused: false});\n }\n }\n\n onFocus(event: any) {\n this.invokeEventCallback('onFocus', [ event, this.proxy]);\n this.setState({ isInputFocused: true});\n }\n\n /**\n * returns the number of decimal places a number have.\n * @param value: number\n * @returns {number}\n */\n private countDecimals(value: any) {\n if (value && ((value % 1) !== 0)) {\n const decimalValue = value.toString().split('.')[1];\n return decimalValue && decimalValue.length;\n }\n return 0;\n }\n\n public validateInputEntry($event: any) {\n const props = this.state.props;\n\n // allow actions if control key is pressed or if backspace is pressed. (for Mozilla).\n if ($event.ctrlKey || includes(['Backspace', 'ArrowRight', 'ArrowLeft', 'Tab', 'Enter', 'Delete'], $event.key)) {\n return;\n }\n\n const validity = new RegExp(`^[\\\\d\\\\s-,.e+${this.GROUP}${this.DECIMAL}]$`, 'i');\n const inputValue = $event.target.value;\n // validates entering of decimal values only when user provides decimal limit(i.e step contains decimal values).\n if (inputValue && this.countDecimals(props.step) && (this.countDecimals(inputValue) >= this.countDecimals(props.step))) {\n $event.preventDefault();\n }\n // validates if user entered an invalid character.\n if (!validity.test($event.key)) {\n $event.preventDefault();\n }\n // a decimal value can be entered only once in the input.\n if (includes(inputValue, this.DECIMAL) && $event.key === this.DECIMAL) {\n $event.preventDefault();\n }\n // 'e' can be entered only once in the input.\n if (intersection(toArray(inputValue), ['e', 'E']).length && includes('eE', $event.key)) {\n $event.preventDefault();\n }\n if ((includes(inputValue, '+') || includes(inputValue, '-')) && ($event.key === '+' || $event.key === '-')) {\n $event.preventDefault();\n }\n this.invokeEventCallback('onKeypress', [ $event, this.proxy]);\n }\n\n /**\n * returns a valid number by validating the minimum and maximum values.\n * @param {number} value\n * @returns {number}\n */\n private getValueInRange(value: number): number {\n const props = this.state.props;\n if (!isNil(value) && !isNaN(props.minvalue) && value < props.minvalue) {\n this.updateState({ errorType: 'minvalue'} as S);\n return props.minvalue;\n }\n if (!isNil(value) && !isNaN(props.maxvalue) && value > props.maxvalue) {\n this.updateState({ errorType: 'maxvalue'} as S);\n return props.maxvalue;\n }\n return value;\n }\n\n /**\n * Adds validations for the number before updating the widget model. like validating min and max value for the widget.\n * @param {number} val number to be validated\n * @returns {number}\n */\n private isValidNumber(val: number): boolean {\n const props = this.state.props;\n\n //empty number widget should not show validation error when required is false\n // @ts-ignore\n if (this.state.props.required === false && val === '') {\n return true;\n }\n // id number is infinite then consider it as invalid value\n if (isNaN(val) || !isFinite(val) || (!Number.isInteger(props.step) &&\n this.countDecimals(val) > this.countDecimals(props.step))) {\n this.updateState({\n isValid: false,\n } as S);\n return false;\n }\n if (val !== this.getValueInRange(val)) {\n this.updateState({\n isValid: false,\n } as S);\n return true;\n }\n this.resetValidations();\n return true;\n }\n\n // resets all the flags related to the widget's validation.\n protected resetValidations() {\n this.updateState({\n isValid: true,\n } as S);\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'minvalue':\n case 'maxvalue':\n if ($new|| $old) {\n this.isValidNumber($new);\n }\n break;\n case 'datavalue':\n this.updateState({\n textValue: $new,\n } as S);\n const isDefault = this.state.isDefault;\n if (isDefault) {\n this.updateState({ isDefault: false } as S, this.props.onFieldChange && this.props.onFieldChange.bind(this, 'datavalue', $new, $old, isDefault));\n } else {\n this.props.onFieldChange && this.props.onFieldChange('datavalue', $new, $old, isDefault);\n }\n break;\n case 'displayValue': \n this.updateState({\n displayValue: $new,\n } as any)\n }\n }\n}\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EACUA,gBAAgBA,CAAA,EAAG;IAC3B,IAAI,CAACpE,WAAW,CAAC;MACfU,OAAO,EAAE;IACX,CAAM,CAAC;EACT;EAEA2D,gBAAgBA,CAACC,IAAY,EAAEC,IAAS,EAAEC,IAAS,EAAE;IACnD,QAAQF,IAAI;MACV,KAAK,UAAU;MACf,KAAK,UAAU;QACb,IAAIC,IAAI,IAAGC,IAAI,EAAE;UACf,IAAI,CAACtC,aAAa,CAACqC,IAAI,CAAC;QAC1B;QACA;MACF,KAAK,WAAW;QACd,IAAI,CAACvE,WAAW,CAAC;UACfC,SAAS,EAAEsE;QACb,CAAM,CAAC;QACP,MAAME,SAAS,GAAG,IAAI,CAAClG,KAAK,CAACkG,SAAS;QACtC,IAAIA,SAAS,EAAE;UACb,IAAI,CAACzE,WAAW,CAAC;YAAEyE,SAAS,EAAE;UAAM,CAAC,EAAO,IAAI,CAAC1G,KAAK,CAAC2E,aAAa,IAAI,IAAI,CAAC3E,KAAK,CAAC2E,aAAa,CAACgC,IAAI,CAAC,IAAI,EAAE,WAAW,EAAEH,IAAI,EAAEC,IAAI,EAAEC,SAAS,CAAC,CAAC;QAClJ,CAAC,MAAM;UACL,IAAI,CAAC1G,KAAK,CAAC2E,aAAa,IAAI,IAAI,CAAC3E,KAAK,CAAC2E,aAAa,CAAC,WAAW,EAAE6B,IAAI,EAAEC,IAAI,EAAEC,SAAS,CAAC;QAC1F;QACA;MACF,KAAK,cAAc;QACjB,IAAI,CAACzE,WAAW,CAAC;UACf2E,YAAY,EAAEJ;QAChB,CAAQ,CAAC;IACb;EACF;AACF","ignoreList":[]}
@@ -80,7 +80,7 @@ export default class WmCheckbox extends BaseComponent {
80
80
  }
81
81
  renderWidget(props) {
82
82
  return /*#__PURE__*/React.createElement(TouchableOpacity, _extends({}, this.getTestPropsForAction(), {
83
- style: this.styles.root,
83
+ style: [this.styles.root, this.state.isChecked ? this.styles.checkedItem : null],
84
84
  onPress: this.onPress.bind(this)
85
85
  }, getAccessibilityProps(AccessibilityWidgetType.CHECKBOX, {
86
86
  hint: props === null || props === void 0 ? void 0 : props.hint,
@@ -94,7 +94,7 @@ export default class WmCheckbox extends BaseComponent {
94
94
  disabled: props.readonly || props.disabled,
95
95
  id: this.getTestId('checkbox')
96
96
  }), /*#__PURE__*/React.createElement(Text, _extends({}, this.getTestPropsForLabel(), {
97
- style: this.styles.text
97
+ style: [this.styles.text, this.state.isChecked ? this.styles.selectedLabel : null]
98
98
  }), props.caption));
99
99
  }
100
100
  }
@@ -1 +1 @@
1
- {"version":3,"names":["React","Text","TouchableOpacity","BaseComponent","BaseComponentState","WmIcon","unStringify","validateField","WmCheckboxProps","DEFAULT_CLASS","AccessibilityWidgetType","getAccessibilityProps","WmCheckboxState","constructor","args","_defineProperty","WmCheckbox","props","setChecked","dataValue","checkedvalue","value","updateState","isChecked","onPropertyChange","name","$new","$old","state","datavalue","updateDatavalue","validate","validationObj","isValid","errorType","onPress","disabled","readonly","invokeEventCallback","proxy","oldValue","uncheckedvalue","onFieldChange","renderWidget","createElement","_extends","getTestPropsForAction","style","styles","root","bind","CHECKBOX","hint","checked","accessibilityRole","accessibilityLabel","caption","_background","iconclass","checkicon","uncheckicon","id","getTestId","getTestPropsForLabel","text"],"sources":["checkbox.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, TouchableOpacity } from 'react-native';\n\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';\nimport {unStringify, validateField} from '@wavemaker/app-rn-runtime/core/utils';\n\nimport WmCheckboxProps from './checkbox.props';\nimport { DEFAULT_CLASS, WmCheckboxStyles } from './checkbox.styles';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility';\n\nexport class WmCheckboxState extends BaseComponentState<WmCheckboxProps> {\n isChecked: boolean = false;\n isValid: boolean = true;\n errorType = '';\n}\n\nexport default class WmCheckbox extends BaseComponent<WmCheckboxProps, WmCheckboxState, WmCheckboxStyles> {\n\n constructor(props: WmCheckboxProps) {\n super(props, DEFAULT_CLASS, new WmCheckboxProps(), new WmCheckboxState());\n }\n\n setChecked(dataValue: any, checkedvalue: any) {\n const value = unStringify(dataValue) === unStringify(checkedvalue, true);\n this.updateState({ isChecked: value } as WmCheckboxState);\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'checkedvalue':\n this.setChecked(this.state.props.datavalue, $new);\n break;\n case 'datavalue':\n this.setChecked($new, this.state.props.checkedvalue);\n break;\n }\n }\n\n updateDatavalue(value: any) {\n this.updateState({ props: { datavalue: value }} as WmCheckboxState);\n }\n validate(value: any) {\n const validationObj = validateField(this.state.props, value);\n this.updateState({\n isValid: validationObj.isValid,\n errorType: validationObj.errorType\n } as WmCheckboxState);\n }\n\n onPress() {\n if (this.state.props.disabled || this.state.props.readonly) {\n return;\n }\n this.invokeEventCallback('onFocus', [null, this.proxy]);\n this.invokeEventCallback('onTap', [null, this.proxy]);\n const oldValue = this.state.props.datavalue;\n const value = !this.state.isChecked;\n this.validate(value);\n this.updateState({ isChecked: value } as WmCheckboxState);\n const dataValue = value === true ? this.state.props.checkedvalue : this.state.props.uncheckedvalue;\n this.updateState({ props: { datavalue: dataValue } } as WmCheckboxState,\n () => {\n if (!this.props.onFieldChange) {\n this.invokeEventCallback('onChange', [null, this.proxy, dataValue, oldValue]);\n } else {\n this.props.onFieldChange && this.props.onFieldChange('datavalue', dataValue, oldValue);\n }\n this.invokeEventCallback('onBlur', [ null, this.proxy ]);\n });\n }\n\n renderWidget(props: WmCheckboxProps) {\n return (\n <TouchableOpacity {...this.getTestPropsForAction()} style={this.styles.root} onPress={this.onPress.bind(this)} {...getAccessibilityProps(AccessibilityWidgetType.CHECKBOX, {hint: props?.hint, checked: this.state.isChecked})} accessibilityRole='checkbox' accessibilityLabel={`Checkbox for ${props.caption}`}>\n {this._background}\n <WmIcon iconclass=\"wi wi-check\" styles={this.state.isChecked ? this.styles.checkicon : this.styles.uncheckicon} disabled={props.readonly || props.disabled} id={this.getTestId('checkbox')}/>\n <Text {...this.getTestPropsForLabel()} style={this.styles.text}>{props.caption}</Text>\n </TouchableOpacity>\n );\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,gBAAgB,QAAQ,cAAc;AAErD,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AACjG,OAAOC,MAAM,MAAM,gEAAgE;AACnF,SAAQC,WAAW,EAAEC,aAAa,QAAO,sCAAsC;AAE/E,OAAOC,eAAe,MAAM,kBAAkB;AAC9C,SAASC,aAAa,QAA0B,mBAAmB;AACnE,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,8CAA8C;AAE7G,OAAO,MAAMC,eAAe,SAASR,kBAAkB,CAAkB;EAAAS,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,oBAClD,KAAK;IAAAA,eAAA,kBACP,IAAI;IAAAA,eAAA,oBACX,EAAE;EAAA;AAChB;AAEA,eAAe,MAAMC,UAAU,SAASb,aAAa,CAAqD;EAExGU,WAAWA,CAACI,KAAsB,EAAE;IAClC,KAAK,CAACA,KAAK,EAAER,aAAa,EAAE,IAAID,eAAe,CAAC,CAAC,EAAE,IAAII,eAAe,CAAC,CAAC,CAAC;EAC3E;EAEAM,UAAUA,CAACC,SAAc,EAAEC,YAAiB,EAAE;IAC5C,MAAMC,KAAK,GAAGf,WAAW,CAACa,SAAS,CAAC,KAAKb,WAAW,CAACc,YAAY,EAAE,IAAI,CAAC;IACxE,IAAI,CAACE,WAAW,CAAC;MAAEC,SAAS,EAAEF;IAAM,CAAoB,CAAC;EAC3D;EAEAG,gBAAgBA,CAACC,IAAY,EAAEC,IAAS,EAAEC,IAAS,EAAE;IACnD,QAAQF,IAAI;MACV,KAAK,cAAc;QACjB,IAAI,CAACP,UAAU,CAAC,IAAI,CAACU,KAAK,CAACX,KAA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KAAK,CAACL,SAAS,GAAG,IAAI,CAACyB,MAAM,CAACW,SAAS,GAAG,IAAI,CAACX,MAAM,CAACY,WAAY;MAACxB,QAAQ,EAAEnB,KAAK,CAACoB,QAAQ,IAAIpB,KAAK,CAACmB,QAAS;MAACyB,EAAE,EAAE,IAAI,CAACC,SAAS,CAAC,UAAU;IAAE,CAAC,CAAC,eAC7L9D,KAAA,CAAA4C,aAAA,CAAC3C,IAAI,EAAA4C,QAAA,KAAK,IAAI,CAACkB,oBAAoB,CAAC,CAAC;MAAEhB,KAAK,EAAE,IAAI,CAACC,MAAM,CAACgB;IAAK,IAAE/C,KAAK,CAACuC,OAAc,CACvE,CAAC;EAEvB;AACF","ignoreList":[]}
1
+ {"version":3,"names":["React","Text","TouchableOpacity","BaseComponent","BaseComponentState","WmIcon","unStringify","validateField","WmCheckboxProps","DEFAULT_CLASS","AccessibilityWidgetType","getAccessibilityProps","WmCheckboxState","constructor","args","_defineProperty","WmCheckbox","props","setChecked","dataValue","checkedvalue","value","updateState","isChecked","onPropertyChange","name","$new","$old","state","datavalue","updateDatavalue","validate","validationObj","isValid","errorType","onPress","disabled","readonly","invokeEventCallback","proxy","oldValue","uncheckedvalue","onFieldChange","renderWidget","createElement","_extends","getTestPropsForAction","style","styles","root","checkedItem","bind","CHECKBOX","hint","checked","accessibilityRole","accessibilityLabel","caption","_background","iconclass","checkicon","uncheckicon","id","getTestId","getTestPropsForLabel","text","selectedLabel"],"sources":["checkbox.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, TouchableOpacity } from 'react-native';\n\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';\nimport {unStringify, validateField} from '@wavemaker/app-rn-runtime/core/utils';\n\nimport WmCheckboxProps from './checkbox.props';\nimport { DEFAULT_CLASS, WmCheckboxStyles } from './checkbox.styles';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility';\n\nexport class WmCheckboxState extends BaseComponentState<WmCheckboxProps> {\n isChecked: boolean = false;\n isValid: boolean = true;\n errorType = '';\n}\n\nexport default class WmCheckbox extends BaseComponent<WmCheckboxProps, WmCheckboxState, WmCheckboxStyles> {\n\n constructor(props: WmCheckboxProps) {\n super(props, DEFAULT_CLASS, new WmCheckboxProps(), new WmCheckboxState());\n }\n\n setChecked(dataValue: any, checkedvalue: any) {\n const value = unStringify(dataValue) === unStringify(checkedvalue, true);\n this.updateState({ isChecked: value } as WmCheckboxState);\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'checkedvalue':\n this.setChecked(this.state.props.datavalue, $new);\n break;\n case 'datavalue':\n this.setChecked($new, this.state.props.checkedvalue);\n break;\n }\n }\n\n updateDatavalue(value: any) {\n this.updateState({ props: { datavalue: value }} as WmCheckboxState);\n }\n validate(value: any) {\n const validationObj = validateField(this.state.props, value);\n this.updateState({\n isValid: validationObj.isValid,\n errorType: validationObj.errorType\n } as WmCheckboxState);\n }\n\n onPress() {\n if (this.state.props.disabled || this.state.props.readonly) {\n return;\n }\n this.invokeEventCallback('onFocus', [null, this.proxy]);\n this.invokeEventCallback('onTap', [null, this.proxy]);\n const oldValue = this.state.props.datavalue;\n const value = !this.state.isChecked;\n this.validate(value);\n this.updateState({ isChecked: value } as WmCheckboxState);\n const dataValue = value === true ? this.state.props.checkedvalue : this.state.props.uncheckedvalue;\n this.updateState({ props: { datavalue: dataValue } } as WmCheckboxState,\n () => {\n if (!this.props.onFieldChange) {\n this.invokeEventCallback('onChange', [null, this.proxy, dataValue, oldValue]);\n } else {\n this.props.onFieldChange && this.props.onFieldChange('datavalue', dataValue, oldValue);\n }\n this.invokeEventCallback('onBlur', [ null, this.proxy ]);\n });\n }\n\n renderWidget(props: WmCheckboxProps) {\n return (\n <TouchableOpacity {...this.getTestPropsForAction()} style={[this.styles.root, this.state.isChecked ? this.styles.checkedItem : null]} onPress={this.onPress.bind(this)} {...getAccessibilityProps(AccessibilityWidgetType.CHECKBOX, {hint: props?.hint, checked: this.state.isChecked})} accessibilityRole='checkbox' accessibilityLabel={`Checkbox for ${props.caption}`}>\n {this._background}\n <WmIcon iconclass=\"wi wi-check\" styles={this.state.isChecked ? this.styles.checkicon : this.styles.uncheckicon} disabled={props.readonly || props.disabled} id={this.getTestId('checkbox')}/>\n <Text {...this.getTestPropsForLabel()} style={[this.styles.text, this.state.isChecked ? this.styles.selectedLabel: null]}>{props.caption}</Text>\n </TouchableOpacity>\n );\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,gBAAgB,QAAQ,cAAc;AAErD,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AACjG,OAAOC,MAAM,MAAM,gEAAgE;AACnF,SAAQC,WAAW,EAAEC,aAAa,QAAO,sCAAsC;AAE/E,OAAOC,eAAe,MAAM,kBAAkB;AAC9C,SAASC,aAAa,QAA0B,mBAAmB;AACnE,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,8CAA8C;AAE7G,OAAO,MAAMC,eAAe,SAASR,kBAAkB,CAAkB;EAAAS,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,oBAClD,KAAK;IAAAA,eAAA,kBACP,IAAI;IAAAA,eAAA,oBACX,EAAE;EAAA;AAChB;AAEA,eAAe,MAAMC,UAAU,SAASb,aAAa,CAAqD;EAExGU,WAAWA,CAACI,KAAsB,EAAE;IAClC,KAAK,CAACA,KAAK,EAAER,aAAa,EAAE,IAAID,eAAe,CAAC,CAAC,EAAE,IAAII,eAAe,CAAC,CAAC,CAAC;EAC3E;EAEAM,UAAUA,CAACC,SAAc,EAAEC,YAAiB,EAAE;IAC5C,MAAMC,KAAK,GAAGf,WAAW,CAACa,SAAS,CAAC,KAAKb,WAAW,CAACc,YAAY,EAAE,IAAI,CAAC;IACxE,IAAI,CAACE,WAAW,CAAC;MAA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uBAALA,KAAK,CAAEoC,IAAI;MAAEC,OAAO,EAAE,IAAI,CAAC1B,KAAK,CAACL;IAAS,CAAC,CAAC;MAAEgC,iBAAiB,EAAC,UAAU;MAACC,kBAAkB,EAAE,gBAAgBvC,KAAK,CAACwC,OAAO;IAAG,IACrW,IAAI,CAACC,WAAW,eACjB1D,KAAA,CAAA4C,aAAA,CAACvC,MAAM;MAACsD,SAAS,EAAC,aAAa;MAACX,MAAM,EAAE,IAAI,CAACpB,KAAK,CAACL,SAAS,GAAG,IAAI,CAACyB,MAAM,CAACY,SAAS,GAAG,IAAI,CAACZ,MAAM,CAACa,WAAY;MAACzB,QAAQ,EAAEnB,KAAK,CAACoB,QAAQ,IAAIpB,KAAK,CAACmB,QAAS;MAAC0B,EAAE,EAAE,IAAI,CAACC,SAAS,CAAC,UAAU;IAAE,CAAC,CAAC,eAC7L/D,KAAA,CAAA4C,aAAA,CAAC3C,IAAI,EAAA4C,QAAA,KAAK,IAAI,CAACmB,oBAAoB,CAAC,CAAC;MAAEjB,KAAK,EAAE,CAAC,IAAI,CAACC,MAAM,CAACiB,IAAI,EAAE,IAAI,CAACrC,KAAK,CAACL,SAAS,GAAG,IAAI,CAACyB,MAAM,CAACkB,aAAa,GAAE,IAAI;IAAE,IAAEjD,KAAK,CAACwC,OAAc,CACjI,CAAC;EAEvB;AACF","ignoreList":[]}
@@ -51,7 +51,9 @@ BASE_THEME.registerStyle((themeVariables, addStyle) => {
51
51
  icon: {
52
52
  color: 'transparent'
53
53
  }
54
- }
54
+ },
55
+ checkedItem: {},
56
+ selectedLabel: {}
55
57
  });
56
58
  addStyle(DEFAULT_CLASS + '-disabled', '', {
57
59
  root: {
@@ -1 +1 @@
1
- {"version":3,"names":["BASE_THEME","defineStyles","DEFAULT_CLASS","registerStyle","themeVariables","addStyle","defaultStyles","root","flexDirection","alignContent","text","alignSelf","fontFamily","baseFont","fontSize","color","labelDefaultColor","marginLeft","skeleton","width","height","checkicon","borderRadius","backgroundColor","primaryColor","justifyContent","alignItems","borderColor","checkedBorderColor","icon","checkedIconColor","padding","uncheckicon","borderWidth","uncheckedBorderColor","uncheckedBgColor","opacity","checkedDisabledColor"],"sources":["checkbox.styles.ts"],"sourcesContent":["import BASE_THEME, { AllStyle } from '@wavemaker/app-rn-runtime/styles/theme';\nimport { BaseStyles, defineStyles } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { WmSkeletonStyles } from '@wavemaker/app-rn-runtime/components/basic/skeleton/skeleton.styles';\nimport { WmIconStyles } from '@wavemaker/app-rn-runtime/components/basic/icon/icon.styles';\n\nexport type WmCheckboxStyles = BaseStyles & {\n skeleton: WmSkeletonStyles;\n checkicon: WmIconStyles;\n uncheckicon: WmIconStyles;\n};\n\nexport const DEFAULT_CLASS = 'app-checkbox';\nBASE_THEME.registerStyle((themeVariables, addStyle) => {\n const defaultStyles: WmCheckboxStyles = defineStyles({\n root: {\n flexDirection: 'row',\n alignContent: 'center',\n },\n text: {\n alignSelf: 'center',\n fontFamily: themeVariables.baseFont,\n fontSize: 16,\n color: themeVariables.labelDefaultColor,\n marginLeft: 8\n },\n skeleton: {\n root: {\n width: '100%',\n height: 16\n }\n } as any as WmSkeletonStyles,\n checkicon : {\n root: {\n width: 20,\n height: 20,\n borderRadius: 4,\n backgroundColor: themeVariables.primaryColor,\n justifyContent: 'center',\n alignItems: 'center',\n borderColor: themeVariables.checkedBorderColor,\n },\n text: {\n fontSize: 18,\n },\n icon : {\n color: themeVariables.checkedIconColor,\n padding: 0\n }\n } as WmIconStyles,\n uncheckicon : {\n root: {\n width: 20,\n height: 20,\n borderWidth: 2,\n borderRadius: 4,\n borderColor: themeVariables.uncheckedBorderColor,\n backgroundColor: themeVariables.uncheckedBgColor,\n },\n text: {},\n icon : {\n color: 'transparent',\n }\n } as WmIconStyles,\n });\n\n\n addStyle(DEFAULT_CLASS + '-disabled', '', {\n root : {\n opacity: 0.8\n },\n text : {\n color: themeVariables.checkedDisabledColor\n }\n });\n\n addStyle(DEFAULT_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AI,EAAE,CAAC,CAAC;MACRmB,IAAI,EAAG;QACLd,KAAK,EAAE;MACT;IACJ;EACA,CAAC,CAAC;EAGJV,QAAQ,CAACH,aAAa,GAAG,WAAW,EAAE,EAAE,EAAE;IACxCK,IAAI,EAAG;MACL6B,OAAO,EAAE;IACX,CAAC;IACD1B,IAAI,EAAG;MACLK,KAAK,EAAEX,cAAc,CAACiC;IACxB;EACF,CAAC,CAAC;EAEFhC,QAAQ,CAACH,aAAa,EAAE,EAAE,EAAEI,aAAa,CAAC;AAC5C,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["BASE_THEME","defineStyles","DEFAULT_CLASS","registerStyle","themeVariables","addStyle","defaultStyles","root","flexDirection","alignContent","text","alignSelf","fontFamily","baseFont","fontSize","color","labelDefaultColor","marginLeft","skeleton","width","height","checkicon","borderRadius","backgroundColor","primaryColor","justifyContent","alignItems","borderColor","checkedBorderColor","icon","checkedIconColor","padding","uncheckicon","borderWidth","uncheckedBorderColor","uncheckedBgColor","checkedItem","selectedLabel","opacity","checkedDisabledColor"],"sources":["checkbox.styles.ts"],"sourcesContent":["import BASE_THEME, { AllStyle } from '@wavemaker/app-rn-runtime/styles/theme';\nimport { BaseStyles, defineStyles } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { WmSkeletonStyles } from '@wavemaker/app-rn-runtime/components/basic/skeleton/skeleton.styles';\nimport { WmIconStyles } from '@wavemaker/app-rn-runtime/components/basic/icon/icon.styles';\n\nexport type WmCheckboxStyles = BaseStyles & {\n skeleton: WmSkeletonStyles;\n checkicon: WmIconStyles;\n uncheckicon: WmIconStyles;\n};\n\nexport const DEFAULT_CLASS = 'app-checkbox';\nBASE_THEME.registerStyle((themeVariables, addStyle) => {\n const defaultStyles: WmCheckboxStyles = defineStyles({\n root: {\n flexDirection: 'row',\n alignContent: 'center',\n },\n text: {\n alignSelf: 'center',\n fontFamily: themeVariables.baseFont,\n fontSize: 16,\n color: themeVariables.labelDefaultColor,\n marginLeft: 8\n },\n skeleton: {\n root: {\n width: '100%',\n height: 16\n }\n } as any as WmSkeletonStyles,\n checkicon : {\n root: {\n width: 20,\n height: 20,\n borderRadius: 4,\n backgroundColor: themeVariables.primaryColor,\n justifyContent: 'center',\n alignItems: 'center',\n borderColor: themeVariables.checkedBorderColor,\n },\n text: {\n fontSize: 18,\n },\n icon : {\n color: themeVariables.checkedIconColor,\n padding: 0\n }\n } as WmIconStyles,\n uncheckicon : {\n root: {\n width: 20,\n height: 20,\n borderWidth: 2,\n borderRadius: 4,\n borderColor: themeVariables.uncheckedBorderColor,\n backgroundColor: themeVariables.uncheckedBgColor,\n },\n text: {},\n icon : {\n color: 'transparent',\n }\n } as WmIconStyles,\n checkedItem: {} as AllStyle,\n selectedLabel: {} as AllStyle,\n });\n\n\n addStyle(DEFAULT_CLASS + '-disabled', '', {\n root : {\n opacity: 0.8\n },\n text : {\n color: themeVariables.checkedDisabledColor\n }\n });\n\n addStyle(DEFAULT_CLASS, '', defaultStyles);\n });\n"],"mappings":"AAAA,OAAOA,UAAU,MAAoB,wCAAwC;AAC7E,SAAqBC,YAAY,QAAQ,+CAA+C;AAUxF,OAAO,MAAMC,aAAa,GAAG,cAAc;AAC3CF,UAAU,CAACG,aAAa,CAAC,CAACC,cAAc,EAAEC,QAAQ,KAAK;EACnD,MAAMC,aAA+B,GAAGL,YAAY,CAAC;IACjDM,IAAI,EAAE;MACJC,aAAa,EAAE,KAAK;MACpBC,YAAY,EAAE;IAChB,CAAC;IACDC,IAAI,EAAE;MACJC,SAAS,EAAE,QAAQ;MACnBC,UAAU,EAAER,cAAc,CAACS,QAAQ;MACnCC,QAAQ,EAAE,EAAE;MACZC,KAAK,EAAEX,cAAc,CAACY,iBAAiB;MACvCC,UAAU,EAAE;IACd,CAAC;IACDC,QAAQ,EAAE;MACRX,IAAI,EAAE;QACJY,KAAK,EAAE,MAAM;QACbC,MAAM,EAAE;MACV;IACF,CAA4B;IAC5BC,SAAS,EAAG;MACVd,IAAI,EAAE;QAC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