@wavemaker/app-rn-runtime 12.0.0-next.45032 → 12.0.0-next.45503

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. app-rn-runtime/components/advanced/carousel/carousel.component.js +18 -3
  2. app-rn-runtime/components/advanced/carousel/carousel.component.js.map +1 -1
  3. app-rn-runtime/components/advanced/webview/webview.component.js.map +1 -1
  4. app-rn-runtime/components/basic/anchor/anchor.component.js +2 -2
  5. app-rn-runtime/components/basic/anchor/anchor.component.js.map +1 -1
  6. app-rn-runtime/components/basic/animatedview.component.js +6 -2
  7. app-rn-runtime/components/basic/animatedview.component.js.map +1 -1
  8. app-rn-runtime/components/basic/audio/audio.component.js.map +1 -1
  9. app-rn-runtime/components/basic/button/button.component.js +5 -4
  10. app-rn-runtime/components/basic/button/button.component.js.map +1 -1
  11. app-rn-runtime/components/basic/icon/icon.component.js +4 -4
  12. app-rn-runtime/components/basic/icon/icon.component.js.map +1 -1
  13. app-rn-runtime/components/basic/label/label.component.js.map +1 -1
  14. app-rn-runtime/components/basic/label/label.styles.js.map +1 -1
  15. app-rn-runtime/components/basic/message/message.component.js.map +1 -1
  16. app-rn-runtime/components/basic/picture/picture.component.js +1 -2
  17. app-rn-runtime/components/basic/picture/picture.component.js.map +1 -1
  18. app-rn-runtime/components/basic/progress-bar/progress-bar.component.js +2 -2
  19. app-rn-runtime/components/basic/progress-bar/progress-bar.component.js.map +1 -1
  20. app-rn-runtime/components/basic/progress-circle/progress-circle.component.js +5 -5
  21. app-rn-runtime/components/basic/progress-circle/progress-circle.component.js.map +1 -1
  22. app-rn-runtime/components/basic/search/search.component.js.map +1 -1
  23. app-rn-runtime/components/basic/spinner/spinner.component.js +2 -3
  24. app-rn-runtime/components/basic/spinner/spinner.component.js.map +1 -1
  25. app-rn-runtime/components/basic/spinner/spinner.styles.js +3 -2
  26. app-rn-runtime/components/basic/spinner/spinner.styles.js.map +1 -1
  27. app-rn-runtime/components/basic/video/video.component.js.map +1 -1
  28. app-rn-runtime/components/basic/video/video.styles.js +4 -1
  29. app-rn-runtime/components/basic/video/video.styles.js.map +1 -1
  30. app-rn-runtime/components/chart/area-chart/area-chart.component.js.map +1 -1
  31. app-rn-runtime/components/chart/basechart.component.js +31 -2
  32. app-rn-runtime/components/chart/basechart.component.js.map +1 -1
  33. app-rn-runtime/components/chart/basechart.props.js +1 -0
  34. app-rn-runtime/components/chart/basechart.props.js.map +1 -1
  35. app-rn-runtime/components/chart/basechart.styles.js +4 -0
  36. app-rn-runtime/components/chart/basechart.styles.js.map +1 -1
  37. app-rn-runtime/components/chart/bubble-chart/bubble-chart.component.js +15 -3
  38. app-rn-runtime/components/chart/bubble-chart/bubble-chart.component.js.map +1 -1
  39. app-rn-runtime/components/chart/pie-chart/pie-chart.component.js +4 -1
  40. app-rn-runtime/components/chart/pie-chart/pie-chart.component.js.map +1 -1
  41. app-rn-runtime/components/chart/stack-chart/stack-chart.component.js +37 -11
  42. app-rn-runtime/components/chart/stack-chart/stack-chart.component.js.map +1 -1
  43. app-rn-runtime/components/container/accordion/accordion.component.js +3 -1
  44. app-rn-runtime/components/container/accordion/accordion.component.js.map +1 -1
  45. app-rn-runtime/components/container/accordion/accordion.styles.js +1 -0
  46. app-rn-runtime/components/container/accordion/accordion.styles.js.map +1 -1
  47. app-rn-runtime/components/container/layoutgrid/gridcolumn/gridcolumn.component.js.map +1 -1
  48. app-rn-runtime/components/container/panel/panel.component.js +4 -2
  49. app-rn-runtime/components/container/panel/panel.component.js.map +1 -1
  50. app-rn-runtime/components/container/tabs/tabheader/tabheader.component.js +2 -3
  51. app-rn-runtime/components/container/tabs/tabheader/tabheader.component.js.map +1 -1
  52. app-rn-runtime/components/container/tabs/tabs.component.js.map +1 -1
  53. app-rn-runtime/components/container/wizard/wizard.component.js +27 -11
  54. app-rn-runtime/components/container/wizard/wizard.component.js.map +1 -1
  55. app-rn-runtime/components/data/form/form-field/form-field.component.js.map +1 -1
  56. app-rn-runtime/components/data/list/list.component.js.map +1 -1
  57. app-rn-runtime/components/dialogs/dialog/dialog.component.js +5 -3
  58. app-rn-runtime/components/dialogs/dialog/dialog.component.js.map +1 -1
  59. app-rn-runtime/components/input/basedataset/basedataset.component.js.map +1 -1
  60. app-rn-runtime/components/input/baseinput/baseinput.component.js +11 -4
  61. app-rn-runtime/components/input/baseinput/baseinput.component.js.map +1 -1
  62. app-rn-runtime/components/input/baseinput/baseinput.props.js +1 -0
  63. app-rn-runtime/components/input/baseinput/baseinput.props.js.map +1 -1
  64. app-rn-runtime/components/input/basenumber/basenumber.component.js +25 -12
  65. app-rn-runtime/components/input/basenumber/basenumber.component.js.map +1 -1
  66. app-rn-runtime/components/input/basenumber/basenumber.props.js +2 -0
  67. app-rn-runtime/components/input/basenumber/basenumber.props.js.map +1 -1
  68. app-rn-runtime/components/input/checkbox/checkbox.component.js +5 -6
  69. app-rn-runtime/components/input/checkbox/checkbox.component.js.map +1 -1
  70. app-rn-runtime/components/input/checkboxset/checkboxset.component.js +3 -2
  71. app-rn-runtime/components/input/checkboxset/checkboxset.component.js.map +1 -1
  72. app-rn-runtime/components/input/chips/chips.component.js +3 -2
  73. app-rn-runtime/components/input/chips/chips.component.js.map +1 -1
  74. app-rn-runtime/components/input/currency/currency.component.js +16 -1
  75. app-rn-runtime/components/input/currency/currency.component.js.map +1 -1
  76. app-rn-runtime/components/input/epoch/base-datetime.component.js +22 -5
  77. app-rn-runtime/components/input/epoch/base-datetime.component.js.map +1 -1
  78. app-rn-runtime/components/input/epoch/wheel-date-picker.component.js +123 -12
  79. app-rn-runtime/components/input/epoch/wheel-date-picker.component.js.map +1 -1
  80. app-rn-runtime/components/input/epoch/wheelpicker/wheelpicker.component.js.map +1 -1
  81. app-rn-runtime/components/input/epoch/wheelpickermodal/date/date-picker-modal.component.js +4 -0
  82. app-rn-runtime/components/input/epoch/wheelpickermodal/date/date-picker-modal.component.js.map +1 -1
  83. app-rn-runtime/components/input/epoch/wheelpickermodal/date/date-picker-modal.props.js +2 -0
  84. app-rn-runtime/components/input/epoch/wheelpickermodal/date/date-picker-modal.props.js.map +1 -1
  85. app-rn-runtime/components/input/number/number.component.js +6 -3
  86. app-rn-runtime/components/input/number/number.component.js.map +1 -1
  87. app-rn-runtime/components/input/radioset/radioset.component.js +6 -6
  88. app-rn-runtime/components/input/radioset/radioset.component.js.map +1 -1
  89. app-rn-runtime/components/input/select/select.component.js +23 -9
  90. app-rn-runtime/components/input/select/select.component.js.map +1 -1
  91. app-rn-runtime/components/input/switch/switch.component.js +2 -2
  92. app-rn-runtime/components/input/switch/switch.component.js.map +1 -1
  93. app-rn-runtime/components/input/toggle/toggle.component.js +2 -4
  94. app-rn-runtime/components/input/toggle/toggle.component.js.map +1 -1
  95. app-rn-runtime/components/navigation/appnavbar/appnavbar.component.js +2 -2
  96. app-rn-runtime/components/navigation/appnavbar/appnavbar.component.js.map +1 -1
  97. app-rn-runtime/components/navigation/basenav/basenav.component.js.map +1 -1
  98. app-rn-runtime/components/navigation/navitem/navitem.component.js +2 -3
  99. app-rn-runtime/components/navigation/navitem/navitem.component.js.map +1 -1
  100. app-rn-runtime/components/navigation/popover/popover.component.js.map +1 -1
  101. app-rn-runtime/components/page/tabbar/curve.js.map +1 -1
  102. app-rn-runtime/components/page/tabbar/tabbar.component.js.map +1 -1
  103. app-rn-runtime/core/base.component.js +2 -1
  104. app-rn-runtime/core/base.component.js.map +1 -1
  105. app-rn-runtime/core/components/textinput.component.js +4 -3
  106. app-rn-runtime/core/components/textinput.component.js.map +1 -1
  107. app-rn-runtime/core/formatters.js.map +1 -1
  108. app-rn-runtime/core/key.extractor.js.map +1 -1
  109. app-rn-runtime/core/props.provider.js +3 -0
  110. app-rn-runtime/core/props.provider.js.map +1 -1
  111. app-rn-runtime/core/storage.service.js.map +1 -1
  112. app-rn-runtime/core/tappable.component.js +26 -25
  113. app-rn-runtime/core/tappable.component.js.map +1 -1
  114. app-rn-runtime/core/ui-preferences.context.js +7 -0
  115. app-rn-runtime/core/ui-preferences.context.js.map +1 -0
  116. app-rn-runtime/core/utils.js +66 -4
  117. app-rn-runtime/core/utils.js.map +1 -1
  118. app-rn-runtime/package.json +28 -7
  119. app-rn-runtime/runtime/App.js +2 -1
  120. app-rn-runtime/runtime/App.js.map +1 -1
  121. app-rn-runtime/runtime/App.navigator.js.map +1 -1
  122. app-rn-runtime/runtime/base-fragment.component.js +15 -0
  123. app-rn-runtime/runtime/base-fragment.component.js.map +1 -1
  124. app-rn-runtime/runtime/base-page.component.js.map +1 -1
  125. app-rn-runtime/runtime/base-prefab.component.js.map +1 -1
  126. app-rn-runtime/runtime/navigator/stack.navigator.js.map +1 -1
  127. app-rn-runtime/runtime/services/app-i18n.service.js +10 -0
  128. app-rn-runtime/runtime/services/app-i18n.service.js.map +1 -1
  129. app-rn-runtime/runtime/services/app-security.service.js.map +1 -1
  130. app-rn-runtime/runtime/services/app-spinner.service.js +1 -1
  131. app-rn-runtime/runtime/services/app-spinner.service.js.map +1 -1
  132. app-rn-runtime/runtime/services/webprocess.service.js.map +1 -1
  133. app-rn-runtime/runtime/watcher.js.map +1 -1
  134. app-rn-runtime/styles/background.component.js +1 -0
  135. app-rn-runtime/styles/background.component.js.map +1 -1
  136. app-rn-runtime/styles/style-prop.validator.js.map +1 -1
  137. app-rn-runtime/styles/theme.js.map +1 -1
  138. app-rn-runtime/variables/base-variable.js.map +1 -1
  139. app-rn-runtime/variables/device/file/upload-file.operation.js.map +1 -1
  140. app-rn-runtime/variables/device-variable.js.map +1 -1
  141. app-rn-runtime/variables/service-variable.js.map +1 -1
@@ -6,6 +6,8 @@ export default class WmDatePickerModalProps extends BaseProps {
6
6
  constructor(...args) {
7
7
  super(...args);
8
8
  _defineProperty(this, "isVisible", false);
9
+ _defineProperty(this, "minDate", void 0);
10
+ _defineProperty(this, "maxDate", void 0);
9
11
  _defineProperty(this, "selectedDate", void 0);
10
12
  _defineProperty(this, "onClose", void 0);
11
13
  _defineProperty(this, "onSelect", void 0);
@@ -1 +1 @@
1
- {"version":3,"names":["BaseProps","WmDatePickerModalProps","constructor","args","_defineProperty"],"sources":["date-picker-modal.props.ts"],"sourcesContent":["import { BaseProps } from \"@wavemaker/app-rn-runtime/core/base.component\";\n\nexport default class WmDatePickerModalProps extends BaseProps {\n isVisible: boolean = false;\n selectedDate?: any;\n onClose?: () => void;\n onSelect?: (date: Date) => void;\n onCancel?: () => void;\n}\n"],"mappings":";;;AAAA,SAASA,SAAS,QAAQ,+CAA+C;AAEzE,eAAe,MAAMC,sBAAsB,SAASD,SAAS,CAAC;EAAAE,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,oBACvC,KAAK;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;EAAA;AAK5B","ignoreList":[]}
1
+ {"version":3,"names":["BaseProps","WmDatePickerModalProps","constructor","args","_defineProperty"],"sources":["date-picker-modal.props.ts"],"sourcesContent":["import { BaseProps } from \"@wavemaker/app-rn-runtime/core/base.component\";\n\nexport default class WmDatePickerModalProps extends BaseProps {\n isVisible: boolean = false;\n minDate?: Date | string;\n maxDate?: Date | string;\n selectedDate?: any;\n onClose?: () => void;\n onSelect?: (date: Date) => void;\n onCancel?: () => void;\n}\n"],"mappings":";;;AAAA,SAASA,SAAS,QAAQ,+CAA+C;AAEzE,eAAe,MAAMC,sBAAsB,SAASD,SAAS,CAAC;EAAAE,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,oBACvC,KAAK;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;EAAA;AAO5B","ignoreList":[]}
@@ -52,14 +52,17 @@ export default class WmNumber extends BaseNumberComponent {
52
52
  autoFocus: props.autofocus,
53
53
  editable: props.disabled || props.readonly ? false : true,
54
54
  placeholder: props.placeholder,
55
- onBlur: this.onBlur.bind(this),
55
+ onBlur: event => {
56
+ this.onBlur.bind(this)(event, !!props.displayValue);
57
+ },
56
58
  onFocus: this.onFocus.bind(this),
57
59
  onKeyPress: this.validateInputEntry.bind(this),
58
60
  onChangeText: text => {
59
- this.onChangeText.bind(this)(text, 'number');
61
+ this.onChangeText.bind(this)(text, 'number', !!props.displayValue);
60
62
  },
61
63
  onChange: this.invokeChange.bind(this),
62
- allowContentSelection: this.styles.text.userSelect === 'text'
64
+ allowContentSelection: this.styles.text.userSelect === 'text',
65
+ customDisplayValue: props.displayValue
63
66
  }));
64
67
  }
65
68
  }
@@ -1 +1 @@
1
- {"version":3,"names":["React","Platform","isNull","WmNumberProps","DEFAULT_CLASS","WMTextInput","BaseNumberComponent","BaseNumberState","AccessibilityWidgetType","getAccessibilityProps","WmNumberState","constructor","args","_defineProperty","WmNumber","props","getStyleClassName","classes","state","floatinglabel","push","join","renderWidget","_this$state$textValue","opts","valueExpr","OS","textValue","toString","createElement","_extends","getTestPropsForInput","NUMBER","ref","widgetRef","selectionStart","selectionEnd","cursor","floatingLabel","floatingLabelStyle","styles","activeFloatingLabelStyle","activeFloatingLabel","style","root","isValid","invalid","keyboardType","placeholderTextColor","placeholderText","color","autoFocus","autofocus","editable","disabled","readonly","placeholder","onBlur","bind","onFocus","onKeyPress","validateInputEntry","onChangeText","text","onChange","invokeChange","allowContentSelection","userSelect"],"sources":["number.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Platform } from 'react-native';\nimport { isNull } from 'lodash';\n\nimport WmNumberProps from './number.props';\nimport { DEFAULT_CLASS, WmNumberStyles } from './number.styles';\nimport { WMTextInput } from '@wavemaker/app-rn-runtime/core/components/textinput.component';\nimport {\n BaseNumberComponent,\n BaseNumberState\n} from '@wavemaker/app-rn-runtime/components/input/basenumber/basenumber.component';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility'; \n\nexport class WmNumberState extends BaseNumberState<WmNumberProps> {\n keyboardType: any;\n}\n\nexport default class WmNumber extends BaseNumberComponent<WmNumberProps, WmNumberState, WmNumberStyles> {\n\n constructor(props: WmNumberProps) {\n super(props, DEFAULT_CLASS, new WmNumberProps(), new WmNumberState());\n }\n\n public getStyleClassName(): string | undefined {\n const classes = [];\n if (this.state.props.floatinglabel) {\n classes.push('app-number-with-label'); \n }\n classes.push(super.getStyleClassName());\n return classes.join(' ');\n }\n\n renderWidget(props: WmNumberProps) {\n let opts: any = {};\n const valueExpr = Platform.OS === 'web' ? 'value' : 'defaultValue';\n opts[valueExpr] = this.state.textValue?.toString() || '';\n return (<WMTextInput\n {...this.getTestPropsForInput()}\n {...getAccessibilityProps(AccessibilityWidgetType.NUMBER, props)}\n ref={(ref: any) => {this.widgetRef = ref;\n // @ts-ignore\n if (ref && !isNull(ref.selectionStart) && !isNull(ref.selectionEnd)) {\n // @ts-ignore\n ref.selectionStart = ref.selectionEnd = this.cursor;\n }}}\n {...opts}\n floatingLabel={props.floatinglabel}\n floatingLabelStyle={this.styles.floatingLabel}\n activeFloatingLabelStyle={this.styles.activeFloatingLabel}\n style={[this.styles.root, this.state.isValid ? {} : this.styles.invalid]}\n keyboardType=\"numeric\"\n placeholderTextColor={this.styles.placeholderText.color as any}\n autoFocus={props.autofocus}\n editable={props.disabled || props.readonly ? false : true}\n placeholder={props.placeholder}\n onBlur={this.onBlur.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onKeyPress={this.validateInputEntry.bind(this)}\n onChangeText={(text) => {\n this.onChangeText.bind(this)(text, 'number');\n }}\n onChange={this.invokeChange.bind(this)}\n allowContentSelection={this.styles.text.userSelect === 'text'}\n />);\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,MAAM,QAAQ,QAAQ;AAE/B,OAAOC,aAAa,MAAM,gBAAgB;AAC1C,SAASC,aAAa,QAAwB,iBAAiB;AAC/D,SAASC,WAAW,QAAQ,+DAA+D;AAC3F,SACEC,mBAAmB,EACnBC,eAAe,QACV,4EAA4E;AACnF,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,8CAA8C;AAE7G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,UAAU,KAAK;IAAO,EAC/D,CAAC;EACJ;AACF","ignoreList":[]}
1
+ {"version":3,"names":["React","Platform","isNull","WmNumberProps","DEFAULT_CLASS","WMTextInput","BaseNumberComponent","BaseNumberState","AccessibilityWidgetType","getAccessibilityProps","WmNumberState","constructor","args","_defineProperty","WmNumber","props","getStyleClassName","classes","state","floatinglabel","push","join","renderWidget","_this$state$textValue","opts","valueExpr","OS","textValue","toString","createElement","_extends","getTestPropsForInput","NUMBER","ref","widgetRef","selectionStart","selectionEnd","cursor","floatingLabel","floatingLabelStyle","styles","activeFloatingLabelStyle","activeFloatingLabel","style","root","isValid","invalid","keyboardType","placeholderTextColor","placeholderText","color","autoFocus","autofocus","editable","disabled","readonly","placeholder","onBlur","event","bind","displayValue","onFocus","onKeyPress","validateInputEntry","onChangeText","text","onChange","invokeChange","allowContentSelection","userSelect","customDisplayValue"],"sources":["number.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Platform } from 'react-native';\nimport { isNull } from 'lodash';\n\nimport WmNumberProps from './number.props';\nimport { DEFAULT_CLASS, WmNumberStyles } from './number.styles';\nimport { WMTextInput } from '@wavemaker/app-rn-runtime/core/components/textinput.component';\nimport {\n BaseNumberComponent,\n BaseNumberState\n} from '@wavemaker/app-rn-runtime/components/input/basenumber/basenumber.component';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility'; \n\nexport class WmNumberState extends BaseNumberState<WmNumberProps> {\n keyboardType: any;\n}\n\nexport default class WmNumber extends BaseNumberComponent<WmNumberProps, WmNumberState, WmNumberStyles> {\n\n constructor(props: WmNumberProps) {\n super(props, DEFAULT_CLASS, new WmNumberProps(), new WmNumberState());\n }\n\n public getStyleClassName(): string | undefined {\n const classes = [];\n if (this.state.props.floatinglabel) {\n classes.push('app-number-with-label'); \n }\n classes.push(super.getStyleClassName());\n return classes.join(' ');\n }\n\n renderWidget(props: WmNumberProps) {\n let opts: any = {};\n const valueExpr = Platform.OS === 'web' ? 'value' : 'defaultValue';\n opts[valueExpr] = this.state.textValue?.toString() || '';\n return (<WMTextInput\n {...this.getTestPropsForInput()}\n {...getAccessibilityProps(AccessibilityWidgetType.NUMBER, props)}\n ref={(ref: any) => {this.widgetRef = ref;\n // @ts-ignore\n if (ref && !isNull(ref.selectionStart) && !isNull(ref.selectionEnd)) {\n // @ts-ignore\n ref.selectionStart = ref.selectionEnd = this.cursor;\n }}}\n {...opts}\n floatingLabel={props.floatinglabel}\n floatingLabelStyle={this.styles.floatingLabel}\n activeFloatingLabelStyle={this.styles.activeFloatingLabel}\n style={[this.styles.root, this.state.isValid ? {} : this.styles.invalid]}\n keyboardType=\"numeric\"\n placeholderTextColor={this.styles.placeholderText.color as any}\n autoFocus={props.autofocus}\n editable={props.disabled || props.readonly ? false : true}\n placeholder={props.placeholder}\n onBlur={(event)=>{this.onBlur.bind(this)(event, !!props.displayValue)}}\n onFocus={this.onFocus.bind(this)}\n onKeyPress={this.validateInputEntry.bind(this)}\n onChangeText={(text) => {\n this.onChangeText.bind(this)(text, 'number', !!props.displayValue);\n }}\n onChange={this.invokeChange.bind(this)}\n allowContentSelection={this.styles.text.userSelect === 'text'}\n customDisplayValue={props.displayValue}\n />);\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,MAAM,QAAQ,QAAQ;AAE/B,OAAOC,aAAa,MAAM,gBAAgB;AAC1C,SAASC,aAAa,QAAwB,iBAAiB;AAC/D,SAASC,WAAW,QAAQ,+DAA+D;AAC3F,SACEC,mBAAmB,EACnBC,eAAe,QACV,4EAA4E;AACnF,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,8CAA8C;AAE7G,OAAO,MAAMC,aAAa,SAASH,eAAe,CAAgB;EAAAI,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA;EAAA;AAElE;AAEA,eAAe,MAAMC,QAAQ,SAASR,mBAAmB,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C,kBAAkB,EAAEvD,KAAK,CAAC6C;IAAa,EACxC,CAAC;EACJ;AACF","ignoreList":[]}
@@ -22,10 +22,10 @@ export default class WmRadioset extends BaseDatasetComponent {
22
22
  super(props, DEFAULT_CLASS, new WmRadiosetProps());
23
23
  }
24
24
  onPress(item) {
25
- this.invokeEventCallback('onTap', [null, this.proxy]);
26
25
  if (this.state.props.disabled || this.state.props.readonly) {
27
26
  return;
28
27
  }
28
+ this.invokeEventCallback('onTap', [null, this.proxy]);
29
29
  item.selected = true;
30
30
  let selectedValue = "";
31
31
  const selectedItem = find(this.state.dataItems, d => isEqual(d.key, item.key));
@@ -51,14 +51,14 @@ export default class WmRadioset extends BaseDatasetComponent {
51
51
  }],
52
52
  onPress: this.onPress.bind(this, item),
53
53
  key: item.key
54
- }, this.getTestPropsForAction()), /*#__PURE__*/React.createElement(WmIcon, _extends({}, this.getTestProps('' + index), {
54
+ }, this.getTestPropsForAction("radio" + index)), /*#__PURE__*/React.createElement(WmIcon, {
55
+ id: this.getTestId('radiobutton' + index),
55
56
  iconclass: "wi wi-fiber-manual-record",
56
57
  styles: item.selected ? this.styles.checkedRadio : this.styles.uncheckedRadio,
57
- disabled: this.state.props.readonly || this.state.props.disabled,
58
- accessibilitylabel: `Radio button for ${displayText}`
59
- })), !isEmpty(this.state.template) && this.props.renderitempartial ? this.props.renderitempartial(item.dataObject, index, this.state.template) : /*#__PURE__*/React.createElement(Text, _extends({
58
+ disabled: this.state.props.readonly || this.state.props.disabled
59
+ }), !isEmpty(this.state.template) && this.props.renderitempartial ? this.props.renderitempartial(item.dataObject, index, this.state.template) : /*#__PURE__*/React.createElement(Text, _extends({
60
60
  style: this.styles.radioLabel
61
- }, this.getTestPropsForLabel('caption')), displayText));
61
+ }, this.getTestPropsForLabel('caption' + index)), displayText));
62
62
  }
63
63
  setTemplate(partialName) {
64
64
  this.updateState({
@@ -1 +1 @@
1
- {"version":3,"names":["React","View","Text","TouchableOpacity","ScrollView","WmRadiosetProps","DEFAULT_CLASS","BaseDatasetComponent","BaseDatasetState","WmIcon","find","isEqual","isEmpty","WmRadiosetState","constructor","args","_defineProperty","WmRadioset","props","onPress","item","invokeEventCallback","proxy","state","disabled","readonly","selected","selectedValue","selectedItem","dataItems","d","key","oldValue","datavalue","datafield","validate","updateState","computeDisplayValue","undefined","renderChild","index","colWidth","displayText","displayexp","displayfield","value","getItemKey","createElement","_extends","style","styles","width","bind","getTestPropsForAction","getTestProps","iconclass","checkedRadio","uncheckedRadio","accessibilitylabel","template","renderitempartial","dataObject","radioLabel","getTestPropsForLabel","setTemplate","partialName","renderGroupby","groupedData","accessibilityRole","length","map","groupObj","groupHeaderTitle","renderRadioButtons","data","items","noOfColumns","itemsperrow","xs","Math","round","group","renderWidget","root","horizontal","groupby"],"sources":["radioset.component.tsx"],"sourcesContent":["import React from 'react';\nimport { View, Text, DimensionValue, TouchableOpacity } from 'react-native';\nimport { ScrollView } from 'react-native-gesture-handler';\n\nimport WmRadiosetProps from './radioset.props';\nimport { DEFAULT_CLASS, WmRadiosetStyles } from './radioset.styles';\nimport {\n BaseDatasetComponent,\n BaseDatasetState\n} from '@wavemaker/app-rn-runtime/components/input/basedataset/basedataset.component';\nimport WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';\nimport WmSkeleton, { createSkeleton } from '../../basic/skeleton/skeleton.component';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility';\nimport { find, forEach, isEqual } from 'lodash-es';\nimport { isEmpty } from 'lodash';\n\nexport class WmRadiosetState extends BaseDatasetState<WmRadiosetProps> {\n template: string = '';\n}\n\nexport default class WmRadioset extends BaseDatasetComponent<WmRadiosetProps, WmRadiosetState, WmRadiosetStyles> {\n\n constructor(props: WmRadiosetProps) {\n super(props, DEFAULT_CLASS, new WmRadiosetProps());\n }\n\n onPress(item: any) {\n this.invokeEventCallback('onTap', [null, this.proxy]);\n if (this.state.props.disabled || this.state.props.readonly) {\n return;\n }\n item.selected = true;\n let selectedValue: any = \"\";\n const selectedItem = find(this.state.dataItems, d => isEqual(d.key, item.key));\n const oldValue = this.state.props.datavalue;\n selectedItem.selected = item.selected;\n selectedValue = selectedItem.selected ? selectedItem.datafield : null;\n this.validate(selectedValue);\n this.updateState({ props: { datavalue: selectedValue }} as WmRadiosetState,() => {\n this.computeDisplayValue();\n this.invokeEventCallback('onChange', [ undefined, this.proxy, selectedValue, oldValue ]);\n });\n }\n\n renderChild(item: any, index: any, colWidth: DimensionValue) {\n const displayText = item.displayexp || item.displayfield;\n const value = this.state.props.datafield === 'All Fields' ? this.getItemKey(item.datafield) : item.datafield;\n return (\n <TouchableOpacity style={[\n this.styles.item,\n item.selected ? this.styles.selectedItem : null,\n {width: colWidth}]} onPress={this.onPress.bind(this, item)} key={item.key} {...this.getTestPropsForAction()}>\n <WmIcon {...this.getTestProps('' + index)} iconclass=\"wi wi-fiber-manual-record\" styles={item.selected ? this.styles.checkedRadio : this.styles.uncheckedRadio} disabled={this.state.props.readonly || this.state.props.disabled} accessibilitylabel={`Radio button for ${displayText}`}></WmIcon>\n {!isEmpty(this.state.template) && this.props.renderitempartial ?\n this.props.renderitempartial(item.dataObject, index, this.state.template) : <Text style={this.styles.radioLabel} {...this.getTestPropsForLabel('caption')}>{displayText}</Text>}\n </TouchableOpacity>)\n }\n\n setTemplate(partialName: any) {\n this.updateState({ template: partialName } as WmRadiosetState);\n }\n\n renderGroupby() {\n const groupedData = this.state.groupedData;\n return (\n <View accessibilityRole='radiogroup'>\n {groupedData && groupedData.length\n ? groupedData.map((groupObj: any, index: any) => {\n return(\n <View key={groupObj.key}>\n <Text style={this.styles.groupHeaderTitle}>{groupObj.key}</Text>\n {this.renderRadioButtons(groupObj.data)}\n </View>)\n })\n : null}\n </View>\n );\n }\n\n renderRadioButtons(items: any) {\n const props = this.state.props;\n const noOfColumns = props.itemsperrow.xs || 1;\n const colWidth = Math.round(100/ noOfColumns) + '%' as DimensionValue;\n return(\n <View style={noOfColumns === 1 ? {} : this.styles.group}>\n {items && items.length ?\n items.map((item: any, index: any) => this.renderChild(item, index, colWidth)): null}\n </View>)\n }\n\n renderWidget(props: WmRadiosetProps) {\n const items = this.state.dataItems;\n return (\n <ScrollView style={this.styles.root}>\n <ScrollView horizontal={true}>\n {props.groupby && this.renderGroupby()}\n {!props.groupby && this.renderRadioButtons(items)}\n </ScrollView>\n </ScrollView>\n );\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAkBC,gBAAgB,QAAQ,cAAc;AAC3E,SAASC,UAAU,QAAQ,8BAA8B;AAEzD,OAAOC,eAAe,MAAM,kBAAkB;AAC9C,SAASC,aAAa,QAA0B,mBAAmB;AACnE,SACEC,oBAAoB,EACpBC,gBAAgB,QACX,8EAA8E;AACrF,OAAOC,MAAM,MAAM,gEAAgE;AAGnF,SAASC,IAAI,EAAWC,OAAO,QAAQ,WAAW;AAClD,SAASC,OAAO,QAAQ,QAAQ;AAEhC,OAAO,MAAMC,eAAe,SAASL,gBAAgB,CAAkB;EAAAM,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,mBAClD,EAAE;EAAA;AACvB;AAEA,eAAe,MAAMC,UAAU,SAASV,oBAAoB,CAAqD;EAE/GO,WAAWA,CAACI,KAAsB,EAAE;IAClC,KAAK,CAACA,KAAK,EAAEZ,aAAa,EAAE,IAAID,eAAe,CAAC,CAAC,CAAC;EACpD;EAEAc,OAAOA,CAACC,IAAS,EAAE;IACjB,IAAI,CAACC,mBAAmB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,CAACC,KAAK,CAAC,CAAC;IACrD,IAAI,IAAI,CAACC,KAAK,CAACL,KAAK,CAACM,QAAQ,IAAI,IAAI,CAACD,KAAK,CAACL,KAAK,CAACO,QAAQ,EAAE;MAC1D;IACF;IACAL,IAAI,CAACM,QAAQ,GAAG,IAAI;IACpB,IAAIC,aAAkB,GAAG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AAA+C,aAAA,CAAC3C,UAAU;MAAC6C,KAAK,EAAE,IAAI,CAACC,MAAM,CAACiC;IAAK,gBAClCnF,KAAA,CAAA+C,aAAA,CAAC3C,UAAU;MAACgF,UAAU,EAAE;IAAK,GAC1BlE,KAAK,CAACmE,OAAO,IAAI,IAAI,CAACnB,aAAa,CAAC,CAAC,EACrC,CAAChD,KAAK,CAACmE,OAAO,IAAI,IAAI,CAACZ,kBAAkB,CAACE,KAAK,CACtC,CACF,CAAC;EAEjB;AACF","ignoreList":[]}
1
+ {"version":3,"names":["React","View","Text","TouchableOpacity","ScrollView","WmRadiosetProps","DEFAULT_CLASS","BaseDatasetComponent","BaseDatasetState","WmIcon","find","isEqual","isEmpty","WmRadiosetState","constructor","args","_defineProperty","WmRadioset","props","onPress","item","state","disabled","readonly","invokeEventCallback","proxy","selected","selectedValue","selectedItem","dataItems","d","key","oldValue","datavalue","datafield","validate","updateState","computeDisplayValue","undefined","renderChild","index","colWidth","displayText","displayexp","displayfield","value","getItemKey","createElement","_extends","style","styles","width","bind","getTestPropsForAction","id","getTestId","iconclass","checkedRadio","uncheckedRadio","template","renderitempartial","dataObject","radioLabel","getTestPropsForLabel","setTemplate","partialName","renderGroupby","groupedData","accessibilityRole","length","map","groupObj","groupHeaderTitle","renderRadioButtons","data","items","noOfColumns","itemsperrow","xs","Math","round","group","renderWidget","root","horizontal","groupby"],"sources":["radioset.component.tsx"],"sourcesContent":["import React from 'react';\nimport { View, Text, DimensionValue, TouchableOpacity } from 'react-native';\nimport { ScrollView } from 'react-native-gesture-handler';\n\nimport WmRadiosetProps from './radioset.props';\nimport { DEFAULT_CLASS, WmRadiosetStyles } from './radioset.styles';\nimport {\n BaseDatasetComponent,\n BaseDatasetState\n} from '@wavemaker/app-rn-runtime/components/input/basedataset/basedataset.component';\nimport WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';\nimport WmSkeleton, { createSkeleton } from '../../basic/skeleton/skeleton.component';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility';\nimport { find, forEach, isEqual } from 'lodash-es';\nimport { isEmpty } from 'lodash';\n\nexport class WmRadiosetState extends BaseDatasetState<WmRadiosetProps> {\n template: string = '';\n}\n\nexport default class WmRadioset extends BaseDatasetComponent<WmRadiosetProps, WmRadiosetState, WmRadiosetStyles> {\n\n constructor(props: WmRadiosetProps) {\n super(props, DEFAULT_CLASS, new WmRadiosetProps());\n }\n\n onPress(item: any) {\n if (this.state.props.disabled || this.state.props.readonly) {\n return;\n }\n this.invokeEventCallback('onTap', [null, this.proxy]);\n item.selected = true;\n let selectedValue: any = \"\";\n const selectedItem = find(this.state.dataItems, d => isEqual(d.key, item.key));\n const oldValue = this.state.props.datavalue;\n selectedItem.selected = item.selected;\n selectedValue = selectedItem.selected ? selectedItem.datafield : null;\n this.validate(selectedValue);\n this.updateState({ props: { datavalue: selectedValue }} as WmRadiosetState,() => {\n this.computeDisplayValue();\n this.invokeEventCallback('onChange', [ undefined, this.proxy, selectedValue, oldValue ]);\n });\n }\n\n renderChild(item: any, index: any, colWidth: DimensionValue) {\n const displayText = item.displayexp || item.displayfield;\n const value = this.state.props.datafield === 'All Fields' ? this.getItemKey(item.datafield) : item.datafield;\n return (\n <TouchableOpacity style={[\n this.styles.item,\n item.selected ? this.styles.selectedItem : null,\n {width: colWidth}]} onPress={this.onPress.bind(this, item)} key={item.key} {...this.getTestPropsForAction(\"radio\"+index)}>\n <WmIcon id={this.getTestId('radiobutton' + index)} iconclass=\"wi wi-fiber-manual-record\" styles={item.selected ? this.styles.checkedRadio : this.styles.uncheckedRadio} disabled={this.state.props.readonly || this.state.props.disabled}></WmIcon>\n {!isEmpty(this.state.template) && this.props.renderitempartial ?\n this.props.renderitempartial(item.dataObject, index, this.state.template) : <Text style={this.styles.radioLabel} {...this.getTestPropsForLabel('caption'+index)}>{displayText}</Text>}\n </TouchableOpacity>)\n }\n\n setTemplate(partialName: any) {\n this.updateState({ template: partialName } as WmRadiosetState);\n }\n\n renderGroupby() {\n const groupedData = this.state.groupedData;\n return (\n <View accessibilityRole='radiogroup'>\n {groupedData && groupedData.length\n ? groupedData.map((groupObj: any, index: any) => {\n return(\n <View key={groupObj.key}>\n <Text style={this.styles.groupHeaderTitle}>{groupObj.key}</Text>\n {this.renderRadioButtons(groupObj.data)}\n </View>)\n })\n : null}\n </View>\n );\n }\n\n renderRadioButtons(items: any) {\n const props = this.state.props;\n const noOfColumns = props.itemsperrow.xs || 1;\n const colWidth = Math.round(100/ noOfColumns) + '%' as DimensionValue;\n return(\n <View style={noOfColumns === 1 ? {} : this.styles.group}>\n {items && items.length ?\n items.map((item: any, index: any) => this.renderChild(item, index, colWidth)): null}\n </View>)\n }\n\n renderWidget(props: WmRadiosetProps) {\n const items = this.state.dataItems;\n return (\n <ScrollView style={this.styles.root}>\n <ScrollView horizontal={true}>\n {props.groupby && this.renderGroupby()}\n {!props.groupby && this.renderRadioButtons(items)}\n </ScrollView>\n </ScrollView>\n );\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAkBC,gBAAgB,QAAQ,cAAc;AAC3E,SAASC,UAAU,QAAQ,8BAA8B;AAEzD,OAAOC,eAAe,MAAM,kBAAkB;AAC9C,SAASC,aAAa,QAA0B,mBAAmB;AACnE,SACEC,oBAAoB,EACpBC,gBAAgB,QACX,8EAA8E;AACrF,OAAOC,MAAM,MAAM,gEAAgE;AAGnF,SAASC,IAAI,EAAWC,OAAO,QAAQ,WAAW;AAClD,SAASC,OAAO,QAAQ,QAAQ;AAEhC,OAAO,MAAMC,eAAe,SAASL,gBAAgB,CAAkB;EAAAM,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,mBAClD,EAAE;EAAA;AACvB;AAEA,eAAe,MAAMC,UAAU,SAASV,oBAAoB,CAAqD;EAE/GO,WAAWA,CAACI,KAAsB,EAAE;IAClC,KAAK,CAACA,KA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G,IAAI,CAAC1B,MAAM,CAAC+B;IAAM,GACrDN,KAAK,IAAIA,KAAK,CAACN,MAAM,GACpBM,KAAK,CAACL,GAAG,CAAC,CAAClD,IAAS,EAAEoB,KAAU,KAAK,IAAI,CAACD,WAAW,CAACnB,IAAI,EAAEoB,KAAK,EAAEC,QAAQ,CAAC,CAAC,GAAE,IAC7E,CAAC;EACX;EAEAyC,YAAYA,CAAChE,KAAsB,EAAE;IACnC,MAAMyD,KAAK,GAAG,IAAI,CAACtD,KAAK,CAACQ,SAAS;IAClC,oBACE7B,KAAA,CAAA+C,aAAA,CAAC3C,UAAU;MAAC6C,KAAK,EAAE,IAAI,CAACC,MAAM,CAACiC;IAAK,gBAClCnF,KAAA,CAAA+C,aAAA,CAAC3C,UAAU;MAACgF,UAAU,EAAE;IAAK,GAC1BlE,KAAK,CAACmE,OAAO,IAAI,IAAI,CAACnB,aAAa,CAAC,CAAC,EACrC,CAAChD,KAAK,CAACmE,OAAO,IAAI,IAAI,CAACZ,kBAAkB,CAACE,KAAK,CACtC,CACF,CAAC;EAEjB;AACF","ignoreList":[]}
@@ -15,6 +15,7 @@ import WmButton from '@wavemaker/app-rn-runtime/components/basic/button/button.c
15
15
  import { Tappable } from '@wavemaker/app-rn-runtime/core/tappable.component';
16
16
  import ThemeVariables from '@wavemaker/app-rn-runtime/styles/theme.variables';
17
17
  import { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility';
18
+ import { BackgroundComponent } from '@wavemaker/app-rn-runtime/styles/background.component';
18
19
  export class WmSelectState extends BaseDatasetState {
19
20
  constructor(...args) {
20
21
  super(...args);
@@ -90,6 +91,7 @@ export default class WmSelect extends BaseDatasetComponent {
90
91
  }
91
92
  renderSelect() {
92
93
  const props = this.state.props;
94
+ const select = this.styles.root;
93
95
  return (
94
96
  /*#__PURE__*/
95
97
  /*
@@ -104,7 +106,16 @@ export default class WmSelect extends BaseDatasetComponent {
104
106
  this.view = ref;
105
107
  },
106
108
  onLayout: () => {}
107
- }, /*#__PURE__*/React.createElement(Text, _extends({
109
+ }, select.backgroundImage ? /*#__PURE__*/React.createElement(BackgroundComponent, {
110
+ image: select.backgroundImage,
111
+ position: select.backgroundPosition || 'center',
112
+ size: select.backgroundSize || 'contain',
113
+ repeat: select.backgroundRepeat || 'no-repeat',
114
+ resizeMode: select.backgroundResizeMode,
115
+ style: {
116
+ borderRadius: this.styles.root.borderRadius
117
+ }
118
+ }) : null, /*#__PURE__*/React.createElement(Text, _extends({
108
119
  style: [this.styles.text, this.state.props.displayValue ? {} : {
109
120
  color: this.styles.placeholderText.color
110
121
  }],
@@ -132,14 +143,17 @@ export default class WmSelect extends BaseDatasetComponent {
132
143
  }
133
144
  renderSelectItem(item, index, isPlaceholder, isLast) {
134
145
  let selected = this.isSelected(item);
135
- return /*#__PURE__*/React.createElement(Tappable, _extends({}, this.getTestPropsForAction(index + ''), {
136
- onTap: this.onItemSelect.bind(this, item, isPlaceholder)
137
- }, getAccessibilityProps(AccessibilityWidgetType.SELECT, {
138
- ...this.props,
139
- expanded: this.state.isOpened
140
- })), /*#__PURE__*/React.createElement(View, {
146
+ return /*#__PURE__*/React.createElement(Tappable, _extends({}, this.getTestPropsForAction('selectitem' + index), {
147
+ onTap: this.onItemSelect.bind(this, item, isPlaceholder),
148
+ accessibilityProps: {
149
+ ...getAccessibilityProps(AccessibilityWidgetType.SELECT, {
150
+ ...this.props,
151
+ expanded: this.state.isOpened
152
+ })
153
+ }
154
+ }), /*#__PURE__*/React.createElement(View, {
141
155
  style: [this.styles.selectItem, isLast ? this.styles.lastSelectItem : null, selected ? this.styles.selectedItem : null]
142
- }, /*#__PURE__*/React.createElement(Text, _extends({}, this.getTestPropsForLabel(index + ''), {
156
+ }, /*#__PURE__*/React.createElement(Text, _extends({}, this.getTestPropsForLabel('label' + index), {
143
157
  style: [this.styles.selectItemText, {
144
158
  color: isPlaceholder ? this.styles.placeholderText.color : selected ? this.styles.selectedItemText.color : this.styles.selectItemText.color
145
159
  }]
@@ -172,7 +186,7 @@ export default class WmSelect extends BaseDatasetComponent {
172
186
  this.updateDefaultQueryModel();
173
187
  }
174
188
  renderWidget(props) {
175
- return /*#__PURE__*/React.createElement(View, null, this.renderSelect(), this.state.isOpened ? /*#__PURE__*/React.createElement(ModalConsumer, null, modalService => {
189
+ return /*#__PURE__*/React.createElement(View, null, this._background, this.renderSelect(), this.state.isOpened ? /*#__PURE__*/React.createElement(ModalConsumer, null, modalService => {
176
190
  const items = this.state.dataItems;
177
191
  modalService.showModal(this.prepareModalOptions( /*#__PURE__*/React.createElement(ScrollView, {
178
192
  style: {
@@ -1 +1 @@
1
- {"version":3,"names":["React","Text","View","ScrollView","find","isEmpty","WmSelectProps","DEFAULT_CLASS","BaseDatasetComponent","BaseDatasetState","WmIcon","ModalConsumer","WmButton","Tappable","ThemeVariables","AccessibilityWidgetType","getAccessibilityProps","WmSelectState","constructor","args","_defineProperty","WmSelect","props","updateState","isOpened","onPress","event","state","disabled","showPopover","invokeEventCallback","proxy","onPropertyChange","name","$new","$old","isNaN","displayValue","placeholder","prepareModalOptions","content","styles","modalService","o","modalOptions","modalStyle","modal","contentStyle","modalContent","isModal","centered","onClose","hide","isDefaultValue","validate","setTimeout","triggerValidation","setState","hideModal","focus","_this$widgetRef","widgetRef","renderSelect","createElement","style","root","isValid","invalid","backgroundColor","disabledText","ref","view","onLayout","_extends","text","color","placeholderText","getTestPropsForInput","SELECT","bind","arrowButton","iconclass","onTap","hint","isSelected","item","val","datafield","dataObject","datavalue","onItemSelect","isPlaceholder","onChange","renderSelectItem","index","isLast","selected","getTestPropsForAction","expanded","selectItem","lastSelectItem","selectedItem","getTestPropsForLabel","selectItemText","selectedItemText","displayexp","displayfield","id","getTestId","theme","mergeStyle","checkIcon","opacity","updateDefaultQueryModel","dataItems","length","componentDidMount","onDataItemsUpdate","renderWidget","items","showModal","width","maxHeight","INSTANCE","maxModalHeight","contentContainerStyle","dropDownContent","key","map"],"sources":["select.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, View } from 'react-native';\nimport { ScrollView } from 'react-native-gesture-handler';\nimport { find, isEmpty } from 'lodash';\n\nimport WmSelectProps from './select.props';\nimport { DEFAULT_CLASS, WmSelectStyles } from './select.styles';\nimport {\n BaseDatasetComponent,\n BaseDatasetState\n} from '@wavemaker/app-rn-runtime/components/input/basedataset/basedataset.component';\nimport WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';\nimport { ModalConsumer, ModalOptions, ModalService } from '@wavemaker/app-rn-runtime/core/modal.service';\nimport WmButton from '@wavemaker/app-rn-runtime/components/basic/button/button.component';\nimport { Tappable } from '@wavemaker/app-rn-runtime/core/tappable.component';\nimport ThemeVariables from '@wavemaker/app-rn-runtime/styles/theme.variables';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility'; \n\nexport class WmSelectState extends BaseDatasetState<WmSelectProps> {\n modalOptions = {} as ModalOptions;\n isOpened: boolean = false;\n selectedValue: any = '';\n}\n\nexport default class WmSelect extends BaseDatasetComponent<WmSelectProps, WmSelectState, WmSelectStyles> {\n constructor(props: WmSelectProps) {\n super(props, DEFAULT_CLASS, new WmSelectProps(), new WmSelectState());\n }\n view: View = null as any;\n public widgetRef: Text | null = null;\n private isDefaultValue: boolean = true;\n\n onPress(event: any) {\n if (this.state.props.disabled) {\n return;\n }\n if (!this.state.isOpened) {\n this.showPopover();\n }\n this.invokeEventCallback('onFocus', [event, this.proxy]);\n }\n\n onPropertyChange(name: string, $new: any, $old: any): void {\n super.onPropertyChange(name, $new, $old);\n switch(name) {\n case 'datavalue':\n if (isNaN($new) && isEmpty($new)) {\n this.updateState({\n props: {\n displayValue: this.state.props.placeholder || ''\n }\n } as WmSelectState);\n }\n }\n }\n\n prepareModalOptions(content: React.ReactNode, styles: WmSelectStyles, modalService: ModalService) {\n const o = this.state.modalOptions;\n o.modalStyle = styles.modal;\n o.contentStyle = {...styles.modalContent};\n o.content = content;\n o.isModal = true;\n o.centered = true;\n o.onClose = () => {\n this.hide = () => {};\n if (this.isDefaultValue && this.state.props.displayValue === '') {\n this.validate(this.state.props.displayValue);\n setTimeout(() => {\n this.props.triggerValidation && this.props.triggerValidation();\n }, 0);\n }\n this.invokeEventCallback('onBlur', [{}, this.proxy]);\n this.setState({ isOpened: false, modalOptions: {} as ModalOptions } as WmSelectState);\n };\n this.hide = () => modalService.hideModal(this.state.modalOptions);\n return o;\n }\n\n public showPopover = () => {\n this.updateState({ isOpened: true } as WmSelectState);\n };\n\n public hide = () => {};\n\n focus() {\n this?.widgetRef?.focus();\n }\n\n renderSelect() {\n const props = this.state.props;\n return (\n /*\n * onLayout function is required.\n * https://github.com/naoufal/react-native-accordion/pull/19/files\n */\n <View\n style={[this.styles.root, this.state.isValid ? {} : this.styles.invalid, { backgroundColor: props.disabled ? this.styles.disabledText.backgroundColor : this.styles.root.backgroundColor}]}\n ref={(ref) => {\n this.view = ref as View;\n }}\n onLayout={() => {}}>\n <Text\n style={[this.styles.text,\n this.state.props.displayValue ? {} : {color: this.styles.placeholderText.color}]}\n ref={(ref) => {\n this.widgetRef = ref;\n }}\n {...this.getTestPropsForInput()}\n {...getAccessibilityProps(\n AccessibilityWidgetType.SELECT,\n props\n )}\n onPress={this.onPress.bind(this)}>\n {this.state.props.displayValue || props.placeholder || ' '}\n </Text>\n <WmButton\n styles={this.styles.arrowButton}\n iconclass={'wi wi-keyboard-arrow-down'}\n onTap={this.onPress.bind(this)}\n hint={props?.hint}\n />\n </View>\n );\n }\n\n isSelected(item: any) {\n const val = this.state.props.datafield === 'All Fields' ? item.dataObject : item.datafield;\n return this.state.props.datavalue === val;\n }\n\n onItemSelect(item: any, isPlaceholder?: boolean) {\n this.isDefaultValue = false;\n this.onChange(isPlaceholder ? '' : this.state.props.datafield === 'All Fields' ? item.dataObject : item.datafield);\n this.hide();\n }\n\n renderSelectItem(item: any, index: number, isPlaceholder: boolean, isLast: boolean) {\n let selected = this.isSelected(item);\n return (\n <Tappable {...this.getTestPropsForAction(index + '')} onTap={this.onItemSelect.bind(this, item, isPlaceholder)} {...getAccessibilityProps(\n AccessibilityWidgetType.SELECT,\n {...this.props, expanded: this.state.isOpened}\n )}>\n <View style={[this.styles.selectItem, isLast ? this.styles.lastSelectItem : null, selected ? this.styles.selectedItem : null ]}>\n <Text {...this.getTestPropsForLabel(index + '')} style={[this.styles.selectItemText, {color: isPlaceholder ? this.styles.placeholderText.color : selected ? this.styles.selectedItemText.color : this.styles.selectItemText.color}]}>\n {isPlaceholder ? this.state.props.placeholder : (item.displayexp || item.displayfield)}\n </Text>\n <WmIcon id={this.getTestId('checkicon' + index)} iconclass='wi wi-check' styles={this.theme.mergeStyle(this.styles.checkIcon, {\n root: {\n opacity: !isPlaceholder && selected ? 1 : 0\n }\n })}></WmIcon>\n </View>\n </Tappable>\n );\n }\n\n updateDefaultQueryModel() {\n if (this.state.dataItems && this.state.dataItems.length && this.isDefaultValue) {\n const selectedItem = find(this.state.dataItems, (item) => item.selected);\n selectedItem && this.updateState({\n props: {\n displayValue: selectedItem.displayexp || selectedItem.displayfield || ''\n }\n } as WmSelectState);\n }\n }\n\n componentDidMount() {\n super.componentDidMount();\n this.updateDefaultQueryModel();\n }\n\n onDataItemsUpdate() {\n super.onDataItemsUpdate();\n this.updateDefaultQueryModel();\n }\n\n renderWidget(props: WmSelectProps) {\n return (\n <View>\n {this.renderSelect()}\n {this.state.isOpened ? (\n <ModalConsumer>\n {(modalService: ModalService) => {\n const items = this.state.dataItems;\n modalService.showModal(\n this.prepareModalOptions(\n <ScrollView style={{width: '100%', maxHeight: ThemeVariables.INSTANCE.maxModalHeight}} contentContainerStyle={this.styles.dropDownContent}>\n {props.placeholder ?\n <View key={props.name + '_placeholder'} style={this.styles.placeholderText}>\n {this.renderSelectItem({}, 0, true, false)}\n </View>\n : null}\n {items && items.map((item: any, index: number) => (\n <View key={item.key}>\n {this.renderSelectItem(item, index, false, index === items.length - 1)}\n </View>\n ))}\n </ScrollView>,\n this.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A,KAAK,KAAKyB,KAAK,CAACJ,MAAM,GAAG,CAAC,CACjE,CACP,CACO,CAAC,EACb,IAAI,CAAC1E,MAAM,EACXC,YACF,CACF,CAAC;MACD,OAAO,IAAI;IACb,CACa,CAAC,GACd,IACA,CAAC;EAEX;AACF","ignoreList":[]}
1
+ {"version":3,"names":["React","Text","View","ScrollView","find","isEmpty","WmSelectProps","DEFAULT_CLASS","BaseDatasetComponent","BaseDatasetState","WmIcon","ModalConsumer","WmButton","Tappable","ThemeVariables","AccessibilityWidgetType","getAccessibilityProps","BackgroundComponent","WmSelectState","constructor","args","_defineProperty","WmSelect","props","updateState","isOpened","onPress","event","state","disabled","showPopover","invokeEventCallback","proxy","onPropertyChange","name","$new","$old","isNaN","displayValue","placeholder","prepareModalOptions","content","styles","modalService","o","modalOptions","modalStyle","modal","contentStyle","modalContent","isModal","centered","onClose","hide","isDefaultValue","validate","setTimeout","triggerValidation","setState","hideModal","focus","_this$widgetRef","widgetRef","renderSelect","select","root","createElement","style","isValid","invalid","backgroundColor","disabledText","ref","view","onLayout","backgroundImage","image","position","backgroundPosition","size","backgroundSize","repeat","backgroundRepeat","resizeMode","backgroundResizeMode","borderRadius","_extends","text","color","placeholderText","getTestPropsForInput","SELECT","bind","arrowButton","iconclass","onTap","hint","isSelected","item","val","datafield","dataObject","datavalue","onItemSelect","isPlaceholder","onChange","renderSelectItem","index","isLast","selected","getTestPropsForAction","accessibilityProps","expanded","selectItem","lastSelectItem","selectedItem","getTestPropsForLabel","selectItemText","selectedItemText","displayexp","displayfield","id","getTestId","theme","mergeStyle","checkIcon","opacity","updateDefaultQueryModel","dataItems","length","componentDidMount","onDataItemsUpdate","renderWidget","_background","items","showModal","width","maxHeight","INSTANCE","maxModalHeight","contentContainerStyle","dropDownContent","key","map"],"sources":["select.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, View } from 'react-native';\nimport { ScrollView } from 'react-native-gesture-handler';\nimport { find, isEmpty } from 'lodash';\n\nimport WmSelectProps from './select.props';\nimport { DEFAULT_CLASS, WmSelectStyles } from './select.styles';\nimport {\n BaseDatasetComponent,\n BaseDatasetState\n} from '@wavemaker/app-rn-runtime/components/input/basedataset/basedataset.component';\nimport WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';\nimport { ModalConsumer, ModalOptions, ModalService } from '@wavemaker/app-rn-runtime/core/modal.service';\nimport WmButton from '@wavemaker/app-rn-runtime/components/basic/button/button.component';\nimport { Tappable } from '@wavemaker/app-rn-runtime/core/tappable.component';\nimport ThemeVariables from '@wavemaker/app-rn-runtime/styles/theme.variables';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility'; \nimport { BackgroundComponent } from '@wavemaker/app-rn-runtime/styles/background.component';\n\nexport class WmSelectState extends BaseDatasetState<WmSelectProps> {\n modalOptions = {} as ModalOptions;\n isOpened: boolean = false;\n selectedValue: any = '';\n}\n\nexport default class WmSelect extends BaseDatasetComponent<WmSelectProps, WmSelectState, WmSelectStyles> {\n constructor(props: WmSelectProps) {\n super(props, DEFAULT_CLASS, new WmSelectProps(), new WmSelectState());\n }\n view: View = null as any;\n public widgetRef: Text | null = null;\n private isDefaultValue: boolean = true;\n\n onPress(event: any) {\n if (this.state.props.disabled) {\n return;\n }\n if (!this.state.isOpened) {\n this.showPopover();\n }\n this.invokeEventCallback('onFocus', [event, this.proxy]);\n }\n\n onPropertyChange(name: string, $new: any, $old: any): void {\n super.onPropertyChange(name, $new, $old);\n switch(name) {\n case 'datavalue':\n if (isNaN($new) && isEmpty($new)) {\n this.updateState({\n props: {\n displayValue: this.state.props.placeholder || ''\n }\n } as WmSelectState);\n }\n }\n }\n\n prepareModalOptions(content: React.ReactNode, styles: WmSelectStyles, modalService: ModalService) {\n const o = this.state.modalOptions;\n o.modalStyle = styles.modal;\n o.contentStyle = {...styles.modalContent};\n o.content = content;\n o.isModal = true;\n o.centered = true;\n o.onClose = () => {\n this.hide = () => {};\n if (this.isDefaultValue && this.state.props.displayValue === '') {\n this.validate(this.state.props.displayValue);\n setTimeout(() => {\n this.props.triggerValidation && this.props.triggerValidation();\n }, 0);\n }\n this.invokeEventCallback('onBlur', [{}, this.proxy]);\n this.setState({ isOpened: false, modalOptions: {} as ModalOptions } as WmSelectState);\n };\n this.hide = () => modalService.hideModal(this.state.modalOptions);\n return o;\n }\n\n public showPopover = () => {\n this.updateState({ isOpened: true } as WmSelectState);\n };\n\n public hide = () => {};\n\n focus() {\n this?.widgetRef?.focus();\n }\n\n renderSelect() {\n const props = this.state.props;\n const select = this.styles.root as any;\n return (\n /*\n * onLayout function is required.\n * https://github.com/naoufal/react-native-accordion/pull/19/files\n */\n <View\n style={[this.styles.root, this.state.isValid ? {} : this.styles.invalid, { backgroundColor: props.disabled ? this.styles.disabledText.backgroundColor : this.styles.root.backgroundColor}]}\n ref={(ref) => {\n this.view = ref as View;\n }}\n onLayout={() => {}}>\n {select.backgroundImage ? (<BackgroundComponent\n image={select.backgroundImage}\n position={select.backgroundPosition || 'center'}\n size={select.backgroundSize || 'contain'}\n repeat={select.backgroundRepeat || 'no-repeat'}\n resizeMode={select.backgroundResizeMode}\n style={{borderRadius: this.styles.root.borderRadius}}\n ></BackgroundComponent>) : null }\n <Text\n style={[this.styles.text,\n this.state.props.displayValue ? {} : {color: this.styles.placeholderText.color}]}\n ref={(ref) => {\n this.widgetRef = ref;\n }}\n {...this.getTestPropsForInput()}\n {...getAccessibilityProps(\n AccessibilityWidgetType.SELECT,\n props\n )}\n onPress={this.onPress.bind(this)}>\n {this.state.props.displayValue || props.placeholder || ' '}\n </Text>\n <WmButton\n styles={this.styles.arrowButton}\n iconclass={'wi wi-keyboard-arrow-down'}\n onTap={this.onPress.bind(this)}\n hint={props?.hint}\n />\n </View>\n );\n }\n\n isSelected(item: any) {\n const val = this.state.props.datafield === 'All Fields' ? item.dataObject : item.datafield;\n return this.state.props.datavalue === val;\n }\n\n onItemSelect(item: any, isPlaceholder?: boolean) {\n this.isDefaultValue = false;\n this.onChange(isPlaceholder ? '' : this.state.props.datafield === 'All Fields' ? item.dataObject : item.datafield);\n this.hide();\n }\n\n renderSelectItem(item: any, index: number, isPlaceholder: boolean, isLast: boolean) {\n let selected = this.isSelected(item);\n return (\n <Tappable {...this.getTestPropsForAction('selectitem'+index)} onTap={this.onItemSelect.bind(this, item, isPlaceholder)} \n accessibilityProps={{...getAccessibilityProps(\n AccessibilityWidgetType.SELECT,\n {...this.props, expanded: this.state.isOpened}\n )}}>\n <View style={[this.styles.selectItem, isLast ? this.styles.lastSelectItem : null, selected ? this.styles.selectedItem : null ]}>\n <Text {...this.getTestPropsForLabel('label'+index)} style={[this.styles.selectItemText, {color: isPlaceholder ? this.styles.placeholderText.color : selected ? this.styles.selectedItemText.color : this.styles.selectItemText.color}]}>\n {isPlaceholder ? this.state.props.placeholder : (item.displayexp || item.displayfield)}\n </Text>\n <WmIcon id={this.getTestId('checkicon' + index)} iconclass='wi wi-check' styles={this.theme.mergeStyle(this.styles.checkIcon, {\n root: {\n opacity: !isPlaceholder && selected ? 1 : 0\n }\n })}></WmIcon>\n </View>\n </Tappable>\n );\n }\n\n updateDefaultQueryModel() {\n if (this.state.dataItems && this.state.dataItems.length && this.isDefaultValue) {\n const selectedItem = find(this.state.dataItems, (item) => item.selected);\n selectedItem && this.updateState({\n props: {\n displayValue: selectedItem.displayexp || selectedItem.displayfield || ''\n }\n } as WmSelectState);\n }\n }\n\n componentDidMount() {\n super.componentDidMount();\n this.updateDefaultQueryModel();\n }\n\n onDataItemsUpdate() {\n super.onDataItemsUpdate();\n this.updateDefaultQueryModel();\n }\n\n renderWidget(props: WmSelectProps) {\n return (\n <View>\n {this._background}\n {this.renderSelect()}\n {this.state.isOpened ? (\n <ModalConsumer>\n {(modalService: ModalService) => {\n const items = this.state.dataItems;\n modalService.showModal(\n this.prepareModalOptions(\n <ScrollView style={{width: '100%', maxHeight: ThemeVariables.INSTANCE.maxModalHeight}} contentContainerStyle={this.styles.dropDownContent}>\n {props.placeholder ?\n <View key={props.name + '_placeholder'} style={this.styles.placeholderText}>\n {this.renderSelectItem({}, 0, true, false)}\n </View>\n : null}\n {items && items.map((item: any, index: number) => (\n <View key={item.key}>\n {this.renderSelectItem(item, index, false, index === items.length - 1)}\n </View>\n ))}\n </ScrollView>,\n this.styles,\n modalService\n )\n );\n return null;\n }}\n </ModalConsumer>\n ) : null}\n </View>\n );\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AACzC,SAASC,UAAU,QAAQ,8BAA8B;AACzD,SAASC,IAAI,EAAEC,OAAO,QAAQ,QAAQ;AAEtC,OAAOC,aAAa,MAAM,gBAAgB;AAC1C,SAASC,aAAa,QAAwB,iBAAiB;AAC/D,SACEC,oBAAoB,EACpBC,gBAAgB,QACX,8EAA8E;AACrF,OAAOC,MAAM,MAAM,gEAAgE;AACnF,SAASC,aAAa,QAAoC,8CAA8C;AACxG,OAAOC,QAAQ,MAAM,oEAAoE;AACzF,SAASC,QAAQ,QAAQ,mDAAmD;AAC5E,OAAOC,cAAc,MAAM,kDAAkD;AAC7E,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,8CAA8C;AAC7G,SAASC,mBAAmB,QAAQ,uDAAuD;AAE3F,OAAO,MAAMC,aAAa,SAAST,gBAAgB,CAAgB;EAAAU,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,uBAClD,CAAC,CAAC;IAAAA,eAAA,mBACG,KAAK;IAAAA,eAAA,wBACJ,EAAE;EAAA;AACzB;AAEA,eAAe,MAAMC,QAAQ,SAASd,oBAAoB,CAA+C;EACvGW,WAAWA,CAACI,KAAoB,EAAE;IAChC,KAAK,CAACA,KAAK,EAAEhB,aAAa,EAAE,IAAID,aAAa,CAAC,CAAC,EAAE,IAAIY,aAAa,CAAC,CAAC,CAAC;IAACG,eAAA,eAE3D,IAAI;IAAAA,eAAA,oBACe,IAAI;IAAA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SAAS;MAClCrF,YAAY,CAAC4F,SAAS,CACpB,IAAI,CAAC/F,mBAAmB,eACtBxC,KAAA,CAAAkE,aAAA,CAAC/D,UAAU;QAACgE,KAAK,EAAE;UAACqE,KAAK,EAAE,MAAM;UAAEC,SAAS,EAAE3H,cAAc,CAAC4H,QAAQ,CAACC;QAAc,CAAE;QAACC,qBAAqB,EAAE,IAAI,CAAClG,MAAM,CAACmG;MAAgB,GACvItH,KAAK,CAACgB,WAAW,gBAChBvC,KAAA,CAAAkE,aAAA,CAAChE,IAAI;QAAC4I,GAAG,EAAEvH,KAAK,CAACW,IAAI,GAAG,cAAe;QAACiC,KAAK,EAAE,IAAI,CAACzB,MAAM,CAAC+C;MAAgB,GACxE,IAAI,CAACiB,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,CACrC,CAAC,GACL,IAAI,EACL4B,KAAK,IAAIA,KAAK,CAACS,GAAG,CAAC,CAAC7C,IAAS,EAAES,KAAa,kBAC3C3G,KAAA,CAAAkE,aAAA,CAAChE,IAAI;QAAC4I,GAAG,EAAE5C,IAAI,CAAC4C;MAAI,GACjB,IAAI,CAACpC,gBAAgB,CAACR,IAAI,EAAES,KAAK,EAAE,KAAK,EAAEA,KAAK,KAAK2B,KAAK,CAACL,MAAM,GAAG,CAAC,CACjE,CACP,CACO,CAAC,EACb,IAAI,CAACvF,MAAM,EACXC,YACF,CACF,CAAC;MACD,OAAO,IAAI;IACb,CACa,CAAC,GACd,IACA,CAAC;EAEX;AACF","ignoreList":[]}
@@ -53,7 +53,7 @@ export default class WmSwitch extends BaseDatasetComponent {
53
53
  }
54
54
  const displayText = item.displayexp || item.displayfield;
55
55
  const isSelected = this.state.props.datafield === 'All Fields' ? isEqual(props.datavalue, item.datafield) : this.state.props.datavalue === item.datafield;
56
- return /*#__PURE__*/React.createElement(Tappable, _extends({}, this.getTestPropsForAction(index + ''), {
56
+ return /*#__PURE__*/React.createElement(Tappable, _extends({}, this.getTestPropsForAction('button' + index), {
57
57
  accessibilityProps: {
58
58
  ...getAccessibilityProps(AccessibilityWidgetType.SWITCH, {
59
59
  selected: isSelected,
@@ -68,7 +68,7 @@ export default class WmSwitch extends BaseDatasetComponent {
68
68
  styles: this.styles.loadingIcon,
69
69
  iconclass: item.icon,
70
70
  caption: displayText
71
- }) : /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(Text, _extends({}, this.getTestPropsForLabel('' + index), {
71
+ }) : /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(Text, _extends({}, this.getTestPropsForLabel('label' + index), {
72
72
  style: [isSelected ? this.styles.selectedButtonText : this.styles.text, {
73
73
  color: isSelected ? this.styles.selectedButton.color : this.styles.button.color
74
74
  }]
@@ -1 +1 @@
1
- {"version":3,"names":["React","Text","View","isEqual","find","WmSwitchProps","DEFAULT_CLASS","WmIcon","BaseDatasetComponent","BaseDatasetState","Tappable","AccessibilityWidgetType","getAccessibilityProps","WmSwitchState","WmSwitch","constructor","props","onChange","value","oldVal","state","datavalue","validate","datafield","selectedItem","dataItems","item","key","dataObject","updateState","isDefault","invokeEvent","invokeEventCallback","undefined","proxy","onTap","event","getItemKey","renderChild","index","btnClass","length","displayText","displayexp","displayfield","isSelected","createElement","_extends","getTestPropsForAction","accessibilityProps","SWITCH","selected","hint","disabled","bind","styles","button","selectedButton","iconclass","id","getTestId","loadingIcon","icon","caption","getTestPropsForLabel","style","selectedButtonText","text","color","renderWidget","items","root","map"],"sources":["switch.component.tsx"],"sourcesContent":["import React from 'react';\nimport {Text, View} from \"react-native\";\nimport { isEqual, find } from 'lodash';\n\nimport WmSwitchProps from './switch.props';\nimport { DEFAULT_CLASS, WmSwitchStyles } from './switch.styles';\nimport WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';\nimport { BaseDatasetComponent, BaseDatasetState } from '../basedataset/basedataset.component';\nimport { Tappable } from '@wavemaker/app-rn-runtime/core/tappable.component';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility';\n\nexport class WmSwitchState extends BaseDatasetState<WmSwitchProps> {}\n\nexport default class WmSwitch extends BaseDatasetComponent<WmSwitchProps, WmSwitchState, WmSwitchStyles> {\n constructor(props: WmSwitchProps) {\n super(props, DEFAULT_CLASS, new WmSwitchProps());\n }\n\n onChange(value: any) {\n if (!value) {\n return;\n }\n const oldVal = this.state.props.datavalue;\n this.validate(value);\n if (value === oldVal) {\n return;\n }\n if (this.state.props.datafield === 'All Fields') {\n const selectedItem = find(this.state.dataItems, (item) => isEqual(item.key, value));\n value = selectedItem && selectedItem.dataObject;\n }\n // @ts-ignore\n this.updateState({props: {datavalue: value}, isDefault: false},\n () => {\n if (!this.props.invokeEvent) {\n this.invokeEventCallback('onChange', [undefined, this.proxy, value, oldVal]);\n }\n });\n }\n\n onTap(event: any, item: any) {\n const value = this.state.props.datafield === 'All Fields' ? this.getItemKey(item.datafield) : item.datafield;\n this.onChange(value);\n this.invokeEventCallback('onTap', [ event, this.proxy ]);\n }\n\n renderChild(item: any, index: any) {\n let btnClass = 'button';\n const props = this.state.props;\n if(index === 0) {\n btnClass = 'firstButton';\n } else if (index+1 === this.state.dataItems.length) {\n btnClass = 'lastButton';\n }\n const displayText = item.displayexp || item.displayfield;\n const isSelected = this.state.props.datafield === 'All Fields' ? isEqual(props.datavalue, item.datafield) : this.state.props.datavalue === item.datafield;\n return (\n <Tappable\n {...this.getTestPropsForAction(index + '')}\n accessibilityProps={{...getAccessibilityProps(AccessibilityWidgetType.SWITCH, {selected: isSelected, hint: props?.hint})}}\n onTap={this.state.props.disabled ? undefined : this.onTap.bind(this, null, item)}\n styles={[\n this.styles.button,\n this.styles[btnClass],\n isSelected ? this.styles.selectedButton : null]}\n key={item.key}>\n {this.state.props.iconclass ?\n (<WmIcon\n id={this.getTestId('icon' + index)}\n styles={this.styles.loadingIcon}\n iconclass={item.icon}\n caption={displayText}></WmIcon>)\n : (<View>\n <Text\n {...this.getTestPropsForLabel('' + index)}\n style={[ isSelected ? this.styles.selectedButtonText : this.styles.text,\n {color: isSelected ? this.styles.selectedButton.color : this.styles.button.color }]}>\n {displayText}\n </Text>\n </View>)}\n </Tappable>\n );\n };\n\n renderWidget(props: WmSwitchProps) {\n const items = this.state.dataItems;\n return (<View style={this.styles.root}>\n {items && items.length ?\n items.map((item: any, index: any) => this.renderChild(item, index)): null}\n </View>);\n }\n}\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAQC,IAAI,EAAEC,IAAI,QAAO,cAAc;AACvC,SAASC,OAAO,EAAEC,IAAI,QAAQ,QAAQ;AAEtC,OAAOC,aAAa,MAAM,gBAAgB;AAC1C,SAASC,aAAa,QAAwB,iBAAiB;AAC/D,OAAOC,MAAM,MAAM,gEAAgE;AACnF,SAASC,oBAAoB,EAAEC,gBAAgB,QAAQ,sCAAsC;AAC7F,SAASC,QAAQ,QAAQ,mDAAmD;AAC5E,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,8CAA8C;AAE7G,OAAO,MAAMC,aAAa,SAASJ,gBAAgB,CAAgB;AAEnE,eAAe,MAAMK,QAAQ,SAASN,oBAAoB,CAA+C;EACvGO,WAAWA,CAACC,KAAoB,EAAE;IAChC,KAAK,CAACA,KAAK,EAAEV,aAAa,EAAE,IAAID,aAAa,CAAC,CAAC,CAAC;EAClD;EAEAY,QAAQA,CAACC,KAAU,EAAE;IACnB,IAAI,CAACA,KAAK,EAAE;MACV;IACF;IACA,MAAMC,MAAM,GAAG,IAAI,CAACC,KAAK,CAACJ,KAAK,CAACK,SAAS;IACzC,IAAI,CAACC,QAAQ,CAACJ,KAAK,CAAC;IACpB,IAAIA,KAAK,KAAKC,MAAM,EAAE;MACpB;IACF;IACA,IAAI,IAAI,CAACC,KAAK,CAACJ,KAAK,CAACO,SAAS,KAAK,YAAY,EAAE;MAC/C,MAAMC,YAAY,GAAGpB,IAAI,CAAC,IAAI,CAACgB,KAAK,CAACK,SAAS,EAAG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AI,qBACJF,KAAA,CAAA8C,aAAA,CAAC7C,IAAI,EAAA8C,QAAA,KACC,IAAI,CAACiB,oBAAoB,CAAC,EAAE,GAAGzB,KAAK,CAAC;MACzC0B,KAAK,EAAE,CAAEpB,UAAU,GAAI,IAAI,CAACU,MAAM,CAACW,kBAAkB,GAAG,IAAI,CAACX,MAAM,CAACY,IAAI,EACtE;QAACC,KAAK,EAAEvB,UAAU,GAAG,IAAI,CAACU,MAAM,CAACE,cAAc,CAACW,KAAK,GAAG,IAAI,CAACb,MAAM,CAACC,MAAM,CAACY;MAAM,CAAC;IAAE,IACrF1B,WACG,CACF,CACJ,CAAC;EAEf;EAEA2B,YAAYA,CAACrD,KAAoB,EAAE;IACjC,MAAMsD,KAAK,GAAG,IAAI,CAAClD,KAAK,CAACK,SAAS;IAClC,oBAAQzB,KAAA,CAAA8C,aAAA,CAAC5C,IAAI;MAAC+D,KAAK,EAAE,IAAI,CAACV,MAAM,CAACgB;IAAK,GACnCD,KAAK,IAAIA,KAAK,CAAC7B,MAAM,GACpB6B,KAAK,CAACE,GAAG,CAAC,CAAC9C,IAAS,EAAEa,KAAU,KAAK,IAAI,CAACD,WAAW,CAACZ,IAAI,EAAEa,KAAK,CAAC,CAAC,GAAE,IACnE,CAAC;EACT;AACF","ignoreList":[]}
1
+ {"version":3,"names":["React","Text","View","isEqual","find","WmSwitchProps","DEFAULT_CLASS","WmIcon","BaseDatasetComponent","BaseDatasetState","Tappable","AccessibilityWidgetType","getAccessibilityProps","WmSwitchState","WmSwitch","constructor","props","onChange","value","oldVal","state","datavalue","validate","datafield","selectedItem","dataItems","item","key","dataObject","updateState","isDefault","invokeEvent","invokeEventCallback","undefined","proxy","onTap","event","getItemKey","renderChild","index","btnClass","length","displayText","displayexp","displayfield","isSelected","createElement","_extends","getTestPropsForAction","accessibilityProps","SWITCH","selected","hint","disabled","bind","styles","button","selectedButton","iconclass","id","getTestId","loadingIcon","icon","caption","getTestPropsForLabel","style","selectedButtonText","text","color","renderWidget","items","root","map"],"sources":["switch.component.tsx"],"sourcesContent":["import React from 'react';\nimport {Text, View} from \"react-native\";\nimport { isEqual, find } from 'lodash';\n\nimport WmSwitchProps from './switch.props';\nimport { DEFAULT_CLASS, WmSwitchStyles } from './switch.styles';\nimport WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';\nimport { BaseDatasetComponent, BaseDatasetState } from '../basedataset/basedataset.component';\nimport { Tappable } from '@wavemaker/app-rn-runtime/core/tappable.component';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility';\n\nexport class WmSwitchState extends BaseDatasetState<WmSwitchProps> {}\n\nexport default class WmSwitch extends BaseDatasetComponent<WmSwitchProps, WmSwitchState, WmSwitchStyles> {\n constructor(props: WmSwitchProps) {\n super(props, DEFAULT_CLASS, new WmSwitchProps());\n }\n\n onChange(value: any) {\n if (!value) {\n return;\n }\n const oldVal = this.state.props.datavalue;\n this.validate(value);\n if (value === oldVal) {\n return;\n }\n if (this.state.props.datafield === 'All Fields') {\n const selectedItem = find(this.state.dataItems, (item) => isEqual(item.key, value));\n value = selectedItem && selectedItem.dataObject;\n }\n // @ts-ignore\n this.updateState({props: {datavalue: value}, isDefault: false},\n () => {\n if (!this.props.invokeEvent) {\n this.invokeEventCallback('onChange', [undefined, this.proxy, value, oldVal]);\n }\n });\n }\n\n onTap(event: any, item: any) {\n const value = this.state.props.datafield === 'All Fields' ? this.getItemKey(item.datafield) : item.datafield;\n this.onChange(value);\n this.invokeEventCallback('onTap', [ event, this.proxy ]);\n }\n\n renderChild(item: any, index: any) {\n let btnClass = 'button';\n const props = this.state.props;\n if(index === 0) {\n btnClass = 'firstButton';\n } else if (index+1 === this.state.dataItems.length) {\n btnClass = 'lastButton';\n }\n const displayText = item.displayexp || item.displayfield;\n const isSelected = this.state.props.datafield === 'All Fields' ? isEqual(props.datavalue, item.datafield) : this.state.props.datavalue === item.datafield;\n return (\n <Tappable\n {...this.getTestPropsForAction('button'+index)}\n accessibilityProps={{...getAccessibilityProps(AccessibilityWidgetType.SWITCH, {selected: isSelected, hint: props?.hint})}}\n onTap={this.state.props.disabled ? undefined : this.onTap.bind(this, null, item)}\n styles={[\n this.styles.button,\n this.styles[btnClass],\n isSelected ? this.styles.selectedButton : null]}\n key={item.key}>\n {this.state.props.iconclass ?\n (<WmIcon\n id={this.getTestId('icon' + index)}\n styles={this.styles.loadingIcon}\n iconclass={item.icon}\n caption={displayText}></WmIcon>)\n : (<View>\n <Text\n {...this.getTestPropsForLabel('label' + index)}\n style={[ isSelected ? this.styles.selectedButtonText : this.styles.text,\n {color: isSelected ? this.styles.selectedButton.color : this.styles.button.color }]}>\n {displayText}\n </Text>\n </View>)}\n </Tappable>\n );\n };\n\n renderWidget(props: WmSwitchProps) {\n const items = this.state.dataItems;\n return (<View style={this.styles.root}>\n {items && items.length ?\n items.map((item: any, index: any) => this.renderChild(item, index)): null}\n </View>);\n }\n}\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAQC,IAAI,EAAEC,IAAI,QAAO,cAAc;AACvC,SAASC,OAAO,EAAEC,IAAI,QAAQ,QAAQ;AAEtC,OAAOC,aAAa,MAAM,gBAAgB;AAC1C,SAASC,aAAa,QAAwB,iBAAiB;AAC/D,OAAOC,MAAM,MAAM,gEAAgE;AACnF,SAASC,oBAAoB,EAAEC,gBAAgB,QAAQ,sCAAsC;AAC7F,SAASC,QAAQ,QAAQ,mDAAmD;AAC5E,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,8CAA8C;AAE7G,OAAO,MAAMC,aAAa,SAASJ,gBAAgB,CAAgB;AAEnE,eAAe,MAAMK,QAAQ,SAASN,oBAAoB,CAA+C;EACvGO,WAAWA,CAACC,KAAoB,EAAE;IAChC,KAAK,CAACA,KAAK,EAAEV,aAAa,EAAE,IAAID,aAAa,CAAC,CAAC,CAAC;EAClD;EAEAY,QAAQA,CAACC,KAAU,EAAE;IACnB,IAAI,CAACA,KAAK,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I,CAACP,KAAK,CAACJ,KAAK,CAAC0C,SAAS,gBACtB1D,KAAA,CAAA8C,aAAA,CAACvC,MAAM;MACNoD,EAAE,EAAE,IAAI,CAACC,SAAS,CAAC,MAAM,GAAGrB,KAAK,CAAE;MACnCgB,MAAM,EAAE,IAAI,CAACA,MAAM,CAACM,WAAY;MAChCH,SAAS,EAAEhC,IAAI,CAACoC,IAAK;MACrBC,OAAO,EAAErB;IAAY,CAAS,CAAC,gBAC9B1C,KAAA,CAAA8C,aAAA,CAAC5C,IAAI,qBACJF,KAAA,CAAA8C,aAAA,CAAC7C,IAAI,EAAA8C,QAAA,KACC,IAAI,CAACiB,oBAAoB,CAAC,OAAO,GAAGzB,KAAK,CAAC;MAC9C0B,KAAK,EAAE,CAAEpB,UAAU,GAAI,IAAI,CAACU,MAAM,CAACW,kBAAkB,GAAG,IAAI,CAACX,MAAM,CAACY,IAAI,EACtE;QAACC,KAAK,EAAEvB,UAAU,GAAG,IAAI,CAACU,MAAM,CAACE,cAAc,CAACW,KAAK,GAAG,IAAI,CAACb,MAAM,CAACC,MAAM,CAACY;MAAM,CAAC;IAAE,IACrF1B,WACG,CACF,CACJ,CAAC;EAEf;EAEA2B,YAAYA,CAACrD,KAAoB,EAAE;IACjC,MAAMsD,KAAK,GAAG,IAAI,CAAClD,KAAK,CAACK,SAAS;IAClC,oBAAQzB,KAAA,CAAA8C,aAAA,CAAC5C,IAAI;MAAC+D,KAAK,EAAE,IAAI,CAACV,MAAM,CAACgB;IAAK,GACnCD,KAAK,IAAIA,KAAK,CAAC7B,MAAM,GACpB6B,KAAK,CAACE,GAAG,CAAC,CAAC9C,IAAS,EAAEa,KAAU,KAAK,IAAI,CAACD,WAAW,CAACZ,IAAI,EAAEa,KAAK,CAAC,CAAC,GAAE,IACnE,CAAC;EACT;AACF","ignoreList":[]}
@@ -103,14 +103,12 @@ export default class WmToggle extends BaseComponent {
103
103
  selected: this.state.isSwitchOn
104
104
  }), {
105
105
  onPress: () => {
106
- if (this.props.disabled) {
106
+ if (this.props.disabled || this.props.readonly) {
107
107
  return;
108
108
  }
109
109
  // Added setTimeout to smooth animation
110
110
  setTimeout(() => {
111
- if (!props.readonly) {
112
- this.invokeEventCallback('onFocus', [null, this]);
113
- }
111
+ this.invokeEventCallback('onFocus', [null, this]);
114
112
  this.invokeEventCallback('onTap', [null, this]);
115
113
  }, 500);
116
114
  this.onToggleSwitch(!this.state.isSwitchOn);
@@ -1 +1 @@
1
- {"version":3,"names":["React","TouchableOpacity","Animated","Easing","View","BackgroundComponent","BaseComponent","BaseComponentState","unStringify","validateField","AccessibilityWidgetType","getAccessibilityProps","WmToggleProps","DEFAULT_CLASS","WmToggleState","constructor","args","_defineProperty","WmToggle","props","Value","onPropertyChange","name","$new","$old","value","state","checkedvalue","updateState","isSwitchOn","updateDatavalue","datavalue","validate","validationObj","isValid","errorType","onToggleSwitch","oldValue","dataValue","uncheckedvalue","sequence","timing","scaleValue","toValue","duration","useNativeDriver","animationValue","easing","linear","start","onFieldChange","invokeEventCallback","proxy","onLayoutChange","event","width","nativeEvent","layout","setState","viewWidth","renderWidget","styles","theme","mergeStyle","getStyle","createElement","_extends","onLayout","e","TOGGLE","selected","onPress","disabled","setTimeout","readonly","getTestPropsForAction","style","root","animation","handle","size","backgroundSize","position","backgroundPosition","image","backgroundImage","repeat","backgroundRepeat","transform","translateX","interpolate","inputRange","outputRange","scale"],"sources":["toggle.component.tsx"],"sourcesContent":["import React from 'react';\nimport { TouchableOpacity, Animated, Easing, LayoutChangeEvent, View } from 'react-native';\n\nimport { BackgroundComponent } from '@wavemaker/app-rn-runtime/styles/background.component';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { unStringify, validateField} from '@wavemaker/app-rn-runtime/core/utils';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility'; \n\nimport WmToggleProps from './toggle.props';\nimport { DEFAULT_CLASS, WmToggleStyles } from './toggle.styles';\n\nexport class WmToggleState extends BaseComponentState<WmToggleProps> {\n isSwitchOn: boolean = false;\n isValid: boolean = true;\n errorType = '';\n viewWidth: number = 0;\n}\n\nexport default class WmToggle extends BaseComponent<WmToggleProps, WmToggleState, WmToggleStyles> {\n\n private animationValue = new Animated.Value(0);\n private scaleValue = new Animated.Value(1);\n\n constructor(props: WmToggleProps) {\n super(props, DEFAULT_CLASS, new WmToggleProps(), new WmToggleState());\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'datavalue':\n let value =\n unStringify($new) ===\n unStringify(this.state.props.checkedvalue, true);\n this.updateState({ isSwitchOn: value } as WmToggleState);\n break;\n }\n }\n\n updateDatavalue(value: any) {\n this.updateState({ props: { datavalue: value }} as WmToggleState);\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 WmToggleState);\n }\n\n onToggleSwitch(value: any) {\n const oldValue = this.state.props.datavalue;\n this.validate(value);\n this.updateState({ isSwitchOn: value } as WmToggleState);\n const dataValue = value === true ? this.state.props.checkedvalue : this.state.props.uncheckedvalue;\n Animated.sequence([\n Animated.timing(this.scaleValue, {\n toValue: 1.6,\n duration: 300,\n useNativeDriver: true,\n }),\n Animated.timing(this.animationValue, {\n toValue: value ? 1 : 0,\n duration: 300,\n easing: Easing.linear,\n useNativeDriver: true,\n }),\n ]).start(() => {\n Animated.timing(this.scaleValue, {\n toValue: value ? 1.5 : 1,\n duration: 0,\n useNativeDriver: true,\n }).start();\n });\n // @ts-ignore\n this.updateState({ props: { datavalue: dataValue } },\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 onLayoutChange(event: LayoutChangeEvent){\n let width = event.nativeEvent.layout.width;\n this.setState({\n viewWidth: width,\n } as WmToggleState);\n }\n\n renderWidget(props: WmToggleProps) {\n const styles = this.theme.mergeStyle(this.styles, \n this.theme.getStyle(this.state.isSwitchOn ? 'app-toggle-on' : 'app-toggle-off'));\n return (\n <TouchableOpacity \n onLayout={(e) => {\n this.onLayoutChange(e);\n }}\n {...getAccessibilityProps(AccessibilityWidgetType.TOGGLE, {...this.props, selected: this.state.isSwitchOn})}\n onPress={() => {\n if (this.props.disabled) {\n return;\n }\n // Added setTimeout to smooth animation\n setTimeout(() => {\n if (!props.readonly) {\n this.invokeEventCallback('onFocus', [null, this]);\n }\n this.invokeEventCallback('onTap', [null, this]);\n }, 500);\n this.onToggleSwitch(!this.state.isSwitchOn);\n }}{...this.getTestPropsForAction()}\n style={styles.root}>\n {styles.root.animation && styles.root.animation === 'none' ? (\n <View style={styles.handle}>\n <BackgroundComponent\n size={styles.handle.backgroundSize || 'contain'}\n position={styles.handle.backgroundPosition}\n image={styles.handle.backgroundImage}\n repeat={styles.handle.backgroundRepeat || 'no-repeat'}\n />\n </View>\n ): ( <Animated.View\n style={[\n styles.handle,\n {\n transform: [\n {\n translateX: this.animationValue.interpolate({\n inputRange: [0, 1],\n outputRange: [0, this.state.viewWidth - (this.styles.handle.width as number + 18)],\n }),\n },\n { scale: this.scaleValue }\n ],\n },\n ]}>\n <BackgroundComponent\n size={styles.handle.backgroundSize || 'contain'}\n position={styles.handle.backgroundPosition}\n image={styles.handle.backgroundImage}\n repeat={styles.handle.backgroundRepeat || 'no-repeat'}\n />\n </Animated.View>)}\n </TouchableOpacity>\n );\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,gBAAgB,EAAEC,QAAQ,EAAEC,MAAM,EAAqBC,IAAI,QAAQ,cAAc;AAE1F,SAASC,mBAAmB,QAAQ,uDAAuD;AAC3F,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AACjG,SAASC,WAAW,EAAEC,aAAa,QAAO,sC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CAAClE,KAAK,CAACiC,SAAS,IAAI,IAAI,CAACE,MAAM,CAACkB,MAAM,CAACxB,KAAK,GAAa,EAAE,CAAC;UACnF,CAAC;QACH,CAAC,EACD;UAAEsC,KAAK,EAAE,IAAI,CAACnD;QAAW,CAAC;MAE9B,CAAC;IACD,gBACF1C,KAAA,CAAAiE,aAAA,CAAC5D,mBAAmB;MAClB2E,IAAI,EAAEnB,MAAM,CAACkB,MAAM,CAACE,cAAc,IAAI,SAAU;MAChDC,QAAQ,EAAErB,MAAM,CAACkB,MAAM,CAACI,kBAAmB;MAC3CC,KAAK,EAAEvB,MAAM,CAACkB,MAAM,CAACM,eAAgB;MACrCC,MAAM,EAAEzB,MAAM,CAACkB,MAAM,CAACQ,gBAAgB,IAAI;IAAY,CACvD,CACY,CACD,CAAC;EAEvB;AACF","ignoreList":[]}
1
+ {"version":3,"names":["React","TouchableOpacity","Animated","Easing","View","BackgroundComponent","BaseComponent","BaseComponentState","unStringify","validateField","AccessibilityWidgetType","getAccessibilityProps","WmToggleProps","DEFAULT_CLASS","WmToggleState","constructor","args","_defineProperty","WmToggle","props","Value","onPropertyChange","name","$new","$old","value","state","checkedvalue","updateState","isSwitchOn","updateDatavalue","datavalue","validate","validationObj","isValid","errorType","onToggleSwitch","oldValue","dataValue","uncheckedvalue","sequence","timing","scaleValue","toValue","duration","useNativeDriver","animationValue","easing","linear","start","onFieldChange","invokeEventCallback","proxy","onLayoutChange","event","width","nativeEvent","layout","setState","viewWidth","renderWidget","styles","theme","mergeStyle","getStyle","createElement","_extends","onLayout","e","TOGGLE","selected","onPress","disabled","readonly","setTimeout","getTestPropsForAction","style","root","animation","handle","size","backgroundSize","position","backgroundPosition","image","backgroundImage","repeat","backgroundRepeat","transform","translateX","interpolate","inputRange","outputRange","scale"],"sources":["toggle.component.tsx"],"sourcesContent":["import React from 'react';\nimport { TouchableOpacity, Animated, Easing, LayoutChangeEvent, View } from 'react-native';\n\nimport { BackgroundComponent } from '@wavemaker/app-rn-runtime/styles/background.component';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { unStringify, validateField} from '@wavemaker/app-rn-runtime/core/utils';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility'; \n\nimport WmToggleProps from './toggle.props';\nimport { DEFAULT_CLASS, WmToggleStyles } from './toggle.styles';\n\nexport class WmToggleState extends BaseComponentState<WmToggleProps> {\n isSwitchOn: boolean = false;\n isValid: boolean = true;\n errorType = '';\n viewWidth: number = 0;\n}\n\nexport default class WmToggle extends BaseComponent<WmToggleProps, WmToggleState, WmToggleStyles> {\n\n private animationValue = new Animated.Value(0);\n private scaleValue = new Animated.Value(1);\n\n constructor(props: WmToggleProps) {\n super(props, DEFAULT_CLASS, new WmToggleProps(), new WmToggleState());\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'datavalue':\n let value =\n unStringify($new) ===\n unStringify(this.state.props.checkedvalue, true);\n this.updateState({ isSwitchOn: value } as WmToggleState);\n break;\n }\n }\n\n updateDatavalue(value: any) {\n this.updateState({ props: { datavalue: value }} as WmToggleState);\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 WmToggleState);\n }\n\n onToggleSwitch(value: any) {\n const oldValue = this.state.props.datavalue;\n this.validate(value);\n this.updateState({ isSwitchOn: value } as WmToggleState);\n const dataValue = value === true ? this.state.props.checkedvalue : this.state.props.uncheckedvalue;\n Animated.sequence([\n Animated.timing(this.scaleValue, {\n toValue: 1.6,\n duration: 300,\n useNativeDriver: true,\n }),\n Animated.timing(this.animationValue, {\n toValue: value ? 1 : 0,\n duration: 300,\n easing: Easing.linear,\n useNativeDriver: true,\n }),\n ]).start(() => {\n Animated.timing(this.scaleValue, {\n toValue: value ? 1.5 : 1,\n duration: 0,\n useNativeDriver: true,\n }).start();\n });\n // @ts-ignore\n this.updateState({ props: { datavalue: dataValue } },\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 onLayoutChange(event: LayoutChangeEvent){\n let width = event.nativeEvent.layout.width;\n this.setState({\n viewWidth: width,\n } as WmToggleState);\n }\n\n renderWidget(props: WmToggleProps) {\n const styles = this.theme.mergeStyle(this.styles, \n this.theme.getStyle(this.state.isSwitchOn ? 'app-toggle-on' : 'app-toggle-off'));\n return (\n <TouchableOpacity \n onLayout={(e) => {\n this.onLayoutChange(e);\n }}\n {...getAccessibilityProps(AccessibilityWidgetType.TOGGLE, {...this.props, selected: this.state.isSwitchOn})}\n onPress={() => {\n if (this.props.disabled || this.props.readonly) {\n return;\n }\n // Added setTimeout to smooth animation\n setTimeout(() => {\n this.invokeEventCallback('onFocus', [null, this]);\n this.invokeEventCallback('onTap', [null, this]);\n }, 500);\n this.onToggleSwitch(!this.state.isSwitchOn);\n }}{...this.getTestPropsForAction()}\n style={styles.root}>\n {styles.root.animation && styles.root.animation === 'none' ? (\n <View style={styles.handle}>\n <BackgroundComponent\n size={styles.handle.backgroundSize || 'contain'}\n position={styles.handle.backgroundPosition}\n image={styles.handle.backgroundImage}\n repeat={styles.handle.backgroundRepeat || 'no-repeat'}\n />\n </View>\n ): ( <Animated.View\n style={[\n styles.handle,\n {\n transform: [\n {\n translateX: this.animationValue.interpolate({\n inputRange: [0, 1],\n outputRange: [0, this.state.viewWidth - (this.styles.handle.width as number + 18)],\n }),\n },\n { scale: this.scaleValue }\n ],\n },\n ]}>\n <BackgroundComponent\n size={styles.handle.backgroundSize || 'contain'}\n position={styles.handle.backgroundPosition}\n image={styles.handle.backgroundImage}\n repeat={styles.handle.backgroundRepeat || 'no-repeat'}\n />\n </Animated.View>)}\n </TouchableOpacity>\n );\n }\n}\n"],"mappings":";;;;A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ACjBwE,KAAK,EAAE,CACLf,MAAM,CAACkB,MAAM,EACb;QACES,SAAS,EAAE,CACT;UACEC,UAAU,EAAE,IAAI,CAAC3C,cAAc,CAAC4C,WAAW,CAAC;YAC1CC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YAClBC,WAAW,EAAE,CAAC,CAAC,EAAE,IAAI,CAAClE,KAAK,CAACiC,SAAS,IAAI,IAAI,CAACE,MAAM,CAACkB,MAAM,CAACxB,KAAK,GAAa,EAAE,CAAC;UACnF,CAAC;QACH,CAAC,EACD;UAAEsC,KAAK,EAAE,IAAI,CAACnD;QAAW,CAAC;MAE9B,CAAC;IACD,gBACF1C,KAAA,CAAAiE,aAAA,CAAC5D,mBAAmB;MAClB2E,IAAI,EAAEnB,MAAM,CAACkB,MAAM,CAACE,cAAc,IAAI,SAAU;MAChDC,QAAQ,EAAErB,MAAM,CAACkB,MAAM,CAACI,kBAAmB;MAC3CC,KAAK,EAAEvB,MAAM,CAACkB,MAAM,CAACM,eAAgB;MACrCC,MAAM,EAAEzB,MAAM,CAACkB,MAAM,CAACQ,gBAAgB,IAAI;IAAY,CACvD,CACY,CACD,CAAC;EAEvB;AACF","ignoreList":[]}
@@ -31,9 +31,9 @@ export default class WmAppNavbar extends BaseComponent {
31
31
  }
32
32
  renderWidget(props) {
33
33
  //@ts-ignore
34
- const badge = props.badgevalue != undefined ? /*#__PURE__*/React.createElement(Badge, {
34
+ const badge = props.badgevalue != undefined ? /*#__PURE__*/React.createElement(Badge, _extends({
35
35
  style: this.styles.badge
36
- }, props.badgevalue) : null;
36
+ }, this.getTestProps('badge')), props.badgevalue) : null;
37
37
  return /*#__PURE__*/React.createElement(View, {
38
38
  style: this.styles.root
39
39
  }, this._background, /*#__PURE__*/React.createElement(View, {
@@ -1 +1 @@
1
- {"version":3,"names":["React","Text","View","BackHandler","Badge","isAndroid","isWebPreviewMode","BaseComponent","BaseComponentState","WmIcon","WmPicture","WmAppNavbarProps","DEFAULT_CLASS","WmAppNavbarState","WmAppNavbar","constructor","props","_defineProperty","onDrawerBtnPress","invokeEventCallback","bind","onBackBtnPress","onSearchBtnPress","subscription","addEventListener","cleanup","push","remove","renderWidget","badge","badgevalue","undefined","createElement","style","styles","root","_background","leftSection","showDrawerButton","id","getTestId","hint","theme","mergeStyle","action","leftnavIcon","iconclass","leftnavpaneliconclass","onTap","backbutton","backIcon","backbuttoniconclass","caption","backbuttonlabel","middleSection","imgsrc","image","picturesource","_extends","content","getTestPropsForLabel","accessibilityRole","title","rightSection","searchbutton","searchbuttoniconclass","children"],"sources":["appnavbar.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, View, BackHandler } from 'react-native';\nimport { Badge } from 'react-native-paper';\n\nimport { isAndroid, isWebPreviewMode } from '@wavemaker/app-rn-runtime/core/utils';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';\nimport WmPicture from '@wavemaker/app-rn-runtime/components/basic/picture/picture.component';\n\nimport WmAppNavbarProps from './appnavbar.props';\nimport { DEFAULT_CLASS, WmAppNavbarStyles } from './appnavbar.styles';\n\nexport class WmAppNavbarState extends BaseComponentState<WmAppNavbarProps> {\n\n}\n\nexport default class WmAppNavbar extends BaseComponent<WmAppNavbarProps, WmAppNavbarState, WmAppNavbarStyles> {\n\n private onDrawerBtnPress: Function;\n private onBackBtnPress: Function;\n private onSearchBtnPress: Function;\n\n constructor(props: WmAppNavbarProps) {\n super(props, DEFAULT_CLASS, new WmAppNavbarProps());\n this.onDrawerBtnPress = (() => this.invokeEventCallback('onDrawerbuttonpress', [null, this])).bind(this);\n this.onBackBtnPress = (() => this.invokeEventCallback('onBackbtnclick', [null, this])).bind(this);\n this.onSearchBtnPress = (() => this.invokeEventCallback('onSearchbuttonpress', [null, this])).bind(this);\n if (isAndroid() && !isWebPreviewMode()) {\n const subscription = BackHandler.addEventListener('hardwareBackPress', () => {\n this.onBackBtnPress();\n return true;\n });\n this.cleanup.push(() => subscription.remove());\n }\n }\n\n renderWidget(props: WmAppNavbarProps) {\n //@ts-ignore\n const badge = props.badgevalue != undefined ? (<Badge style={this.styles.badge}>{props.badgevalue}</Badge>): null;\n return (\n <View style={this.styles.root}>\n {this._background}\n <View style={this.styles.leftSection}>\n {props.showDrawerButton && (<WmIcon\n id={this.getTestId('leftnavbtn')}\n hint={'menu'}\n styles={this.theme.mergeStyle({}, this.styles.action, this.styles.leftnavIcon)}\n iconclass={props.leftnavpaneliconclass}\n onTap={this.onDrawerBtnPress}\n />)}\n {props.backbutton && (<WmIcon\n id={this.getTestId('backbtn')}\n hint={'back'}\n styles={this.theme.mergeStyle({}, this.styles.action, this.styles.backIcon)}\n iconclass={props.backbuttoniconclass}\n caption={props.backbuttonlabel}\n onTap={this.onBackBtnPress}/>)}\n </View>\n <View style={this.styles.middleSection}>\n {props.imgsrc && (\n <WmPicture\n id={this.getTestId('picture')}\n styles={this.styles.image}\n picturesource={props.imgsrc} />)}\n <Text style={this.styles.content} {...this.getTestPropsForLabel('title')} accessibilityRole='header'>{props.title}</Text>\n {badge}\n </View>\n <View style={this.styles.rightSection}>\n {props.searchbutton && (<WmIcon\n id={this.getTestId('searchbtn')}\n styles={this.theme.mergeStyle({}, this.styles.action, this.styles.leftnavIcon)}\n iconclass={props.searchbuttoniconclass}\n onTap={this.onSearchBtnPress}\n />)}\n {props.children}\n </View>\n </View>\n );\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,WAAW,QAAQ,cAAc;AACtD,SAASC,KAAK,QAAQ,oBAAoB;AAE1C,SAASC,SAAS,EAAEC,gBAAgB,QAAQ,sCAAsC;AAClF,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AACjG,OAAOC,MAAM,MAAM,gEAAgE;AACnF,OAAOC,SAAS,MAAM,sEAAsE;AAE5F,OAAOC,gBAAgB,MAAM,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,KAAK,CAACuC,MAAM,iBACbvD,KAAA,CAAAgC,aAAA,CAACtB,SAAS;MACR6B,EAAE,EAAE,IAAI,CAACC,SAAS,CAAC,SAAS,CAAE;MAC9BN,MAAM,EAAE,IAAI,CAACA,MAAM,CAACsB,KAAM;MAC1BC,aAAa,EAAEzC,KAAK,CAACuC;IAAO,CAAE,CAAE,eAClCvD,KAAA,CAAAgC,aAAA,CAAC/B,IAAI,EAAAyD,QAAA;MAACzB,KAAK,EAAE,IAAI,CAACC,MAAM,CAACyB;IAAQ,GAAK,IAAI,CAACC,oBAAoB,CAAC,OAAO,CAAC;MAAEC,iBAAiB,EAAC;IAAQ,IAAE7C,KAAK,CAAC8C,KAAY,CAAC,EACxHjC,KACG,CAAC,eACP7B,KAAA,CAAAgC,aAAA,CAAC9B,IAAI;MAAC+B,KAAK,EAAE,IAAI,CAACC,MAAM,CAAC6B;IAAa,GACnC/C,KAAK,CAACgD,YAAY,iBAAKhE,KAAA,CAAAgC,aAAA,CAACvB,MAAM;MAC7B8B,EAAE,EAAE,IAAI,CAACC,SAAS,CAAC,WAAW,CAAE;MAChCN,MAAM,EAAE,IAAI,CAACQ,KAAK,CAACC,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,CAACT,MAAM,CAACU,MAAM,EAAE,IAAI,CAACV,MAAM,CAACW,WAAW,CAAE;MAC/EC,SAAS,EAAE9B,KAAK,CAACiD,qBAAsB;MACvCjB,KAAK,EAAE,IAAI,CAAC1B;IAAiB,CAC5B,CAAE,EACJN,KAAK,CAACkD,QACH,CACF,CAAC;EAEX;AACF","ignoreList":[]}
1
+ {"version":3,"names":["React","Text","View","BackHandler","Badge","isAndroid","isWebPreviewMode","BaseComponent","BaseComponentState","WmIcon","WmPicture","WmAppNavbarProps","DEFAULT_CLASS","WmAppNavbarState","WmAppNavbar","constructor","props","_defineProperty","onDrawerBtnPress","invokeEventCallback","bind","onBackBtnPress","onSearchBtnPress","subscription","addEventListener","cleanup","push","remove","renderWidget","badge","badgevalue","undefined","createElement","_extends","style","styles","getTestProps","root","_background","leftSection","showDrawerButton","id","getTestId","hint","theme","mergeStyle","action","leftnavIcon","iconclass","leftnavpaneliconclass","onTap","backbutton","backIcon","backbuttoniconclass","caption","backbuttonlabel","middleSection","imgsrc","image","picturesource","content","getTestPropsForLabel","accessibilityRole","title","rightSection","searchbutton","searchbuttoniconclass","children"],"sources":["appnavbar.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, View, BackHandler } from 'react-native';\nimport { Badge } from 'react-native-paper';\n\nimport { isAndroid, isWebPreviewMode } from '@wavemaker/app-rn-runtime/core/utils';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';\nimport WmPicture from '@wavemaker/app-rn-runtime/components/basic/picture/picture.component';\n\nimport WmAppNavbarProps from './appnavbar.props';\nimport { DEFAULT_CLASS, WmAppNavbarStyles } from './appnavbar.styles';\n\nexport class WmAppNavbarState extends BaseComponentState<WmAppNavbarProps> {\n\n}\n\nexport default class WmAppNavbar extends BaseComponent<WmAppNavbarProps, WmAppNavbarState, WmAppNavbarStyles> {\n\n private onDrawerBtnPress: Function;\n private onBackBtnPress: Function;\n private onSearchBtnPress: Function;\n\n constructor(props: WmAppNavbarProps) {\n super(props, DEFAULT_CLASS, new WmAppNavbarProps());\n this.onDrawerBtnPress = (() => this.invokeEventCallback('onDrawerbuttonpress', [null, this])).bind(this);\n this.onBackBtnPress = (() => this.invokeEventCallback('onBackbtnclick', [null, this])).bind(this);\n this.onSearchBtnPress = (() => this.invokeEventCallback('onSearchbuttonpress', [null, this])).bind(this);\n if (isAndroid() && !isWebPreviewMode()) {\n const subscription = BackHandler.addEventListener('hardwareBackPress', () => {\n this.onBackBtnPress();\n return true;\n });\n this.cleanup.push(() => subscription.remove());\n }\n }\n\n renderWidget(props: WmAppNavbarProps) {\n //@ts-ignore\n const badge = props.badgevalue != undefined ? (<Badge style={this.styles.badge} {...this.getTestProps('badge')}>{props.badgevalue}</Badge>): null;\n return (\n <View style={this.styles.root}>\n {this._background}\n <View style={this.styles.leftSection}>\n {props.showDrawerButton && (<WmIcon\n id={this.getTestId('leftnavbtn')}\n hint={'menu'}\n styles={this.theme.mergeStyle({}, this.styles.action, this.styles.leftnavIcon)}\n iconclass={props.leftnavpaneliconclass}\n onTap={this.onDrawerBtnPress}\n />)}\n {props.backbutton && (<WmIcon\n id={this.getTestId('backbtn')}\n hint={'back'}\n styles={this.theme.mergeStyle({}, this.styles.action, this.styles.backIcon)}\n iconclass={props.backbuttoniconclass}\n caption={props.backbuttonlabel}\n onTap={this.onBackBtnPress}/>)}\n </View>\n <View style={this.styles.middleSection}>\n {props.imgsrc && (\n <WmPicture\n id={this.getTestId('picture')}\n styles={this.styles.image}\n picturesource={props.imgsrc} />)}\n <Text style={this.styles.content} {...this.getTestPropsForLabel('title')} accessibilityRole='header'>{props.title}</Text>\n {badge}\n </View>\n <View style={this.styles.rightSection}>\n {props.searchbutton && (<WmIcon\n id={this.getTestId('searchbtn')}\n styles={this.theme.mergeStyle({}, this.styles.action, this.styles.leftnavIcon)}\n iconclass={props.searchbuttoniconclass}\n onTap={this.onSearchBtnPress}\n />)}\n {props.children}\n </View>\n </View>\n );\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,WAAW,QAAQ,cAAc;AACtD,SAASC,KAAK,QAAQ,oBAAoB;AAE1C,SAASC,SAAS,EAAEC,gBAAgB,QAAQ,sCAAsC;AAClF,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AACjG,OAAOC,MAAM,MAAM,gEAAgE;AACnF,OAAOC,SAAS,MAAM,sEAAsE;AAE5F,OAAOC,gBAAgB,MAAM,mBAAmB;AAChD,SAASC,aAAa,QAA2B,oBAAoB;AAErE,OAAO,MAAMC,gBAAgB,SAASL,kBAAkB,CAAmB;AAI3E,eA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tB,SAAS;MACR+B,EAAE,EAAE,IAAI,CAACC,SAAS,CAAC,SAAS,CAAE;MAC9BP,MAAM,EAAE,IAAI,CAACA,MAAM,CAACuB,KAAM;MAC1BC,aAAa,EAAE3C,KAAK,CAACyC;IAAO,CAAE,CAAE,eAClCzD,KAAA,CAAAgC,aAAA,CAAC/B,IAAI,EAAAgC,QAAA;MAACC,KAAK,EAAE,IAAI,CAACC,MAAM,CAACyB;IAAQ,GAAK,IAAI,CAACC,oBAAoB,CAAC,OAAO,CAAC;MAAEC,iBAAiB,EAAC;IAAQ,IAAE9C,KAAK,CAAC+C,KAAY,CAAC,EACxHlC,KACG,CAAC,eACP7B,KAAA,CAAAgC,aAAA,CAAC9B,IAAI;MAACgC,KAAK,EAAE,IAAI,CAACC,MAAM,CAAC6B;IAAa,GACnChD,KAAK,CAACiD,YAAY,iBAAKjE,KAAA,CAAAgC,aAAA,CAACvB,MAAM;MAC7BgC,EAAE,EAAE,IAAI,CAACC,SAAS,CAAC,WAAW,CAAE;MAChCP,MAAM,EAAE,IAAI,CAACS,KAAK,CAACC,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,CAACV,MAAM,CAACW,MAAM,EAAE,IAAI,CAACX,MAAM,CAACY,WAAW,CAAE;MAC/EC,SAAS,EAAEhC,KAAK,CAACkD,qBAAsB;MACvChB,KAAK,EAAE,IAAI,CAAC5B;IAAiB,CAC5B,CAAE,EACJN,KAAK,CAACmD,QACH,CACF,CAAC;EAEX;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["BaseComponent","BaseComponentState","DEFAULT_CLASS","isArray","BaseNavState","constructor","args","_defineProperty","BaseNavComponent","props","defaultClass","defaultProps","defaultState","getValue","item","val","setDataItems","dataset","state","name","dataItems","split","map","s","i","key","label","data","d","itemlabel","icon","itemicon","link","itemlink","badge","itembadge","isactive","childnavigation","itemchildren","updateState","onPropertyChange","$new","$old"],"sources":["basenav.component.ts"],"sourcesContent":["import { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { BaseNavProps } from './basenav.props';\nimport { DEFAULT_CLASS, BaseNavStyles } from './basenav.styles';\nimport { isArray } from 'lodash-es';\n\nexport interface NavigationDataItem {\n key: string;\n label: string;\n icon?: string;\n link?: string;\n badge?: string;\n isactive?: string;\n data: any;\n childnavigation?: any;\n}\n\nexport class BaseNavState <T extends BaseNavProps> extends BaseComponentState<T> {\n dataItems = [] as NavigationDataItem[];\n}\n\nexport abstract class BaseNavComponent< T extends BaseNavProps, S extends BaseNavState<T>, L extends BaseNavStyles> extends BaseComponent<T, S, L> {\n\n constructor(props: T, public defaultClass: string = DEFAULT_CLASS, defaultProps?: T, defaultState?: S) {\n super(props, defaultClass, defaultProps, defaultState);\n }\n\n getValue(item: any, val?: string | ((item: any) => string)) {\n if (typeof val === 'string') {\n return item[val];\n } else if (typeof val === 'function') {\n return val(item);\n }\n return null;\n }\n\n setDataItems(dataset: any = this.state.props.dataset) {\n const name = this.props.name;\n let dataItems = [] as NavigationDataItem[];\n if (typeof dataset === 'string') {\n dataItems = dataset.split(',').map((s, i) => {\n return {\n key: `${name}_item${i}`,\n label: s,\n data: s\n } as NavigationDataItem;\n });\n } else if (dataset) {\n if (!isArray(dataset)) {\n dataset = [dataset];\n }\n dataItems = (dataset as any[]).map((d, i) => {\n return {\n key: `${name}_item${i}`,\n label: this.getValue(d, this.state.props.itemlabel),\n icon: this.getValue(d, this.state.props.itemicon),\n link: this.getValue(d, this.state.props.itemlink),\n badge: this.getValue(d, this.state.props.itembadge),\n isactive: this.getValue(d, this.state.props.isactive),\n data: d,\n childnavigation: this.state.props.itemchildren ? d[this.state.props.itemchildren] : null\n } as NavigationDataItem;\n });\n }\n this.updateState({dataItems: dataItems} as S);\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'dataset':\n this.setDataItems($new);\n break;\n case 'itemlabel':\n case 'itemicon':\n case 'itemlink':\n case 'itemchildren':\n this.setDataItems();\n break;\n }\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QACvB;MACF,KAAK,WAAW;MAChB,KAAK,UAAU;MACf,KAAK,UAAU;MACf,KAAK,cAAc;QACjB,IAAI,CAACzB,YAAY,CAAC,CAAC;QACnB;IACJ;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"names":["BaseComponent","BaseComponentState","DEFAULT_CLASS","isArray","BaseNavState","constructor","args","_defineProperty","BaseNavComponent","props","defaultClass","defaultProps","defaultState","getValue","item","val","setDataItems","dataset","state","name","dataItems","split","map","s","i","key","label","data","d","itemlabel","icon","itemicon","link","itemlink","badge","itembadge","isactive","childnavigation","itemchildren","updateState","onPropertyChange","$new","$old"],"sources":["basenav.component.ts"],"sourcesContent":["import { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { BaseNavProps } from './basenav.props';\nimport { DEFAULT_CLASS, BaseNavStyles } from './basenav.styles';\nimport { isArray } from 'lodash-es';\n\nexport interface NavigationDataItem {\n key: string;\n label: string;\n icon?: string;\n link?: string;\n badge?: string;\n isactive?: string;\n data: any;\n childnavigation?: any;\n}\n\nexport class BaseNavState <T extends BaseNavProps> extends BaseComponentState<T> {\n dataItems = [] as NavigationDataItem[];\n}\n\nexport abstract class BaseNavComponent< T extends BaseNavProps, S extends BaseNavState<T>, L extends BaseNavStyles> extends BaseComponent<T, S, L> {\n\n constructor(props: T, public defaultClass: string = DEFAULT_CLASS, defaultProps?: T, defaultState?: S) {\n super(props, defaultClass, defaultProps, defaultState);\n }\n\n getValue(item: any, val?: string | ((item: any) => string)) {\n if (typeof val === 'string') {\n return item[val];\n } else if (typeof val === 'function') {\n return val(item);\n }\n return null;\n }\n\n setDataItems(dataset: any = this.state.props.dataset) {\n const name = this.props.name;\n let dataItems = [] as NavigationDataItem[];\n if (typeof dataset === 'string') {\n dataItems = dataset.split(',').map((s, i) => {\n return {\n key: `${name}_item${i}`,\n label: s,\n data: s\n } as NavigationDataItem;\n });\n } else if (dataset) {\n if (!isArray(dataset)) {\n dataset = [dataset];\n }\n dataItems = (dataset as any[]).map((d, i) => {\n return {\n key: `${name}_item${i}`,\n label: this.getValue(d, this.state.props.itemlabel),\n icon: this.getValue(d, this.state.props.itemicon),\n link: this.getValue(d, this.state.props.itemlink),\n badge: this.getValue(d, this.state.props.itembadge),\n isactive: this.getValue(d, this.state.props.isactive),\n data: d,\n childnavigation: this.state.props.itemchildren ? d[this.state.props.itemchildren] : null\n } as NavigationDataItem;\n });\n }\n this.updateState({dataItems: dataItems} as S);\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'dataset':\n this.setDataItems($new);\n break;\n case 'itemlabel':\n case 'itemicon':\n case 'itemlink':\n case 'itemchildren':\n this.setDataItems();\n break;\n }\n }\n}\n"],"mappings":";;;AAAA,SAASA,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AAEjG,SAASC,aAAa,QAAuB,kBAAkB;AAC/D,SAASC,OAAO,QAAQ,WAAW;AAanC,OAAO,MAAMC,YAAY,SAAkCH,kBAAkB,CAAI;EAAAI,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,oBACnE,EAAE;EAAA;AAChB;AAEA,OAAO,MAAeC,gBAAgB,SAAsFR,aAAa,CAAU;EAEjJK,WAAWA,CAACI,KAAQ,EAASC,YAAoB,GAAGR,aAAa,EAAES,YAAgB,EAAEC,YAAgB,EAAE;IACrG,KAAK,CAACH,KAAK,EAAEC,YAAY,EAAEC,YAAY,EAAEC,YAAY,CAAC;IAAC,KAD5BF,YAAoB,GAApBA,YAAoB;EAEjD;EAEAG,QAAQA,CAACC,IAAS,EAAEC,GAAsC,EAAE;IAC1D,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;MAC3B,OAAOD,IAAI,CAACC,GAAG,CAAC;IAClB,CAAC,MAAM,IAAI,OAAOA,GAAG,KAAK,UAAU,EAAE;MACpC,OAAOA,GAAG,CAACD,IAAI,CAAC;IAClB;IACA,OAAO,IAAI;EACb;EAEAE,YAAYA,CAACC,OAAY,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QAAQ,CAAC;UACrDT,IAAI,EAAEC,CAAC;UACPS,eAAe,EAAE,IAAI,CAACnB,KAAK,CAACT,KAAK,CAAC6B,YAAY,GAAGV,CAAC,CAAC,IAAI,CAACV,KAAK,CAACT,KAAK,CAAC6B,YAAY,CAAC,GAAG;QACtF,CAAC;MACH,CAAC,CAAC;IACJ;IACA,IAAI,CAACC,WAAW,CAAC;MAACnB,SAAS,EAAEA;IAAS,CAAM,CAAC;EAC/C;EAEAoB,gBAAgBA,CAACrB,IAAY,EAAEsB,IAAS,EAAEC,IAAS,EAAE;IACnD,QAAQvB,IAAI;MACV,KAAK,SAAS;QACZ,IAAI,CAACH,YAAY,CAACyB,IAAI,CAAC;QACvB;MACF,KAAK,WAAW;MAChB,KAAK,UAAU;MACf,KAAK,UAAU;MACf,KAAK,cAAc;QACjB,IAAI,CAACzB,YAAY,CAAC,CAAC;QACnB;IACJ;EACF;AACF","ignoreList":[]}
@@ -39,14 +39,13 @@ export default class WmNavItem extends BaseComponent {
39
39
  }));
40
40
  }
41
41
  if (props.view === 'dropdown') {
42
- child = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TouchableOpacity, {
43
- id: this.getTestId('navlink'),
42
+ child = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TouchableOpacity, _extends({}, this.getTestPropsForAction('navitem'), {
44
43
  onPress: () => {
45
44
  this.updateState({
46
45
  collapsed: !this.state.collapsed
47
46
  });
48
47
  }
49
- }, /*#__PURE__*/React.createElement(View, {
48
+ }), /*#__PURE__*/React.createElement(View, {
50
49
  style: this.styles.dropdownNav
51
50
  }, /*#__PURE__*/React.createElement(WmAnchor, _extends({
52
51
  id: this.getTestId('navlink'),