@wavemaker/app-rn-runtime 12.0.0-next.45031 → 12.0.0-next.45501
Sign up to get free protection for your applications and to get access to all the features.
- app-rn-runtime/components/advanced/carousel/carousel.component.js +18 -3
- app-rn-runtime/components/advanced/carousel/carousel.component.js.map +1 -1
- app-rn-runtime/components/advanced/webview/webview.component.js.map +1 -1
- app-rn-runtime/components/basic/anchor/anchor.component.js +2 -2
- app-rn-runtime/components/basic/anchor/anchor.component.js.map +1 -1
- app-rn-runtime/components/basic/animatedview.component.js +6 -2
- app-rn-runtime/components/basic/animatedview.component.js.map +1 -1
- app-rn-runtime/components/basic/audio/audio.component.js.map +1 -1
- app-rn-runtime/components/basic/button/button.component.js +5 -4
- app-rn-runtime/components/basic/button/button.component.js.map +1 -1
- app-rn-runtime/components/basic/icon/icon.component.js +4 -4
- app-rn-runtime/components/basic/icon/icon.component.js.map +1 -1
- app-rn-runtime/components/basic/label/label.component.js.map +1 -1
- app-rn-runtime/components/basic/label/label.styles.js.map +1 -1
- app-rn-runtime/components/basic/message/message.component.js.map +1 -1
- app-rn-runtime/components/basic/picture/picture.component.js +1 -2
- app-rn-runtime/components/basic/picture/picture.component.js.map +1 -1
- app-rn-runtime/components/basic/progress-bar/progress-bar.component.js +2 -2
- app-rn-runtime/components/basic/progress-bar/progress-bar.component.js.map +1 -1
- app-rn-runtime/components/basic/progress-circle/progress-circle.component.js +5 -5
- app-rn-runtime/components/basic/progress-circle/progress-circle.component.js.map +1 -1
- app-rn-runtime/components/basic/search/search.component.js.map +1 -1
- app-rn-runtime/components/basic/spinner/spinner.component.js +2 -3
- app-rn-runtime/components/basic/spinner/spinner.component.js.map +1 -1
- app-rn-runtime/components/basic/spinner/spinner.styles.js +3 -2
- app-rn-runtime/components/basic/spinner/spinner.styles.js.map +1 -1
- app-rn-runtime/components/basic/video/video.component.js.map +1 -1
- app-rn-runtime/components/basic/video/video.styles.js +4 -1
- app-rn-runtime/components/basic/video/video.styles.js.map +1 -1
- app-rn-runtime/components/chart/area-chart/area-chart.component.js.map +1 -1
- app-rn-runtime/components/chart/basechart.component.js +31 -2
- app-rn-runtime/components/chart/basechart.component.js.map +1 -1
- app-rn-runtime/components/chart/basechart.props.js +1 -0
- app-rn-runtime/components/chart/basechart.props.js.map +1 -1
- app-rn-runtime/components/chart/basechart.styles.js +4 -0
- app-rn-runtime/components/chart/basechart.styles.js.map +1 -1
- app-rn-runtime/components/chart/bubble-chart/bubble-chart.component.js +15 -3
- app-rn-runtime/components/chart/bubble-chart/bubble-chart.component.js.map +1 -1
- app-rn-runtime/components/chart/pie-chart/pie-chart.component.js +4 -1
- app-rn-runtime/components/chart/pie-chart/pie-chart.component.js.map +1 -1
- app-rn-runtime/components/chart/stack-chart/stack-chart.component.js +37 -11
- app-rn-runtime/components/chart/stack-chart/stack-chart.component.js.map +1 -1
- app-rn-runtime/components/container/accordion/accordion.component.js +3 -1
- app-rn-runtime/components/container/accordion/accordion.component.js.map +1 -1
- app-rn-runtime/components/container/accordion/accordion.styles.js +1 -0
- app-rn-runtime/components/container/accordion/accordion.styles.js.map +1 -1
- app-rn-runtime/components/container/layoutgrid/gridcolumn/gridcolumn.component.js.map +1 -1
- app-rn-runtime/components/container/panel/panel.component.js +4 -2
- app-rn-runtime/components/container/panel/panel.component.js.map +1 -1
- app-rn-runtime/components/container/tabs/tabheader/tabheader.component.js +2 -3
- app-rn-runtime/components/container/tabs/tabheader/tabheader.component.js.map +1 -1
- app-rn-runtime/components/container/tabs/tabs.component.js.map +1 -1
- app-rn-runtime/components/container/wizard/wizard.component.js +27 -11
- app-rn-runtime/components/container/wizard/wizard.component.js.map +1 -1
- app-rn-runtime/components/data/form/form-field/form-field.component.js.map +1 -1
- app-rn-runtime/components/data/list/list.component.js.map +1 -1
- app-rn-runtime/components/dialogs/dialog/dialog.component.js +5 -3
- app-rn-runtime/components/dialogs/dialog/dialog.component.js.map +1 -1
- app-rn-runtime/components/input/basedataset/basedataset.component.js.map +1 -1
- app-rn-runtime/components/input/baseinput/baseinput.component.js +11 -4
- app-rn-runtime/components/input/baseinput/baseinput.component.js.map +1 -1
- app-rn-runtime/components/input/baseinput/baseinput.props.js +1 -0
- app-rn-runtime/components/input/baseinput/baseinput.props.js.map +1 -1
- app-rn-runtime/components/input/basenumber/basenumber.component.js +25 -12
- app-rn-runtime/components/input/basenumber/basenumber.component.js.map +1 -1
- app-rn-runtime/components/input/basenumber/basenumber.props.js +2 -0
- app-rn-runtime/components/input/basenumber/basenumber.props.js.map +1 -1
- app-rn-runtime/components/input/checkbox/checkbox.component.js +5 -6
- app-rn-runtime/components/input/checkbox/checkbox.component.js.map +1 -1
- app-rn-runtime/components/input/checkboxset/checkboxset.component.js +3 -2
- app-rn-runtime/components/input/checkboxset/checkboxset.component.js.map +1 -1
- app-rn-runtime/components/input/chips/chips.component.js +3 -2
- app-rn-runtime/components/input/chips/chips.component.js.map +1 -1
- app-rn-runtime/components/input/currency/currency.component.js +16 -1
- app-rn-runtime/components/input/currency/currency.component.js.map +1 -1
- app-rn-runtime/components/input/epoch/base-datetime.component.js +22 -5
- app-rn-runtime/components/input/epoch/base-datetime.component.js.map +1 -1
- app-rn-runtime/components/input/epoch/wheel-date-picker.component.js +123 -12
- app-rn-runtime/components/input/epoch/wheel-date-picker.component.js.map +1 -1
- app-rn-runtime/components/input/epoch/wheelpicker/wheelpicker.component.js.map +1 -1
- app-rn-runtime/components/input/epoch/wheelpickermodal/date/date-picker-modal.component.js +4 -0
- app-rn-runtime/components/input/epoch/wheelpickermodal/date/date-picker-modal.component.js.map +1 -1
- app-rn-runtime/components/input/epoch/wheelpickermodal/date/date-picker-modal.props.js +2 -0
- app-rn-runtime/components/input/epoch/wheelpickermodal/date/date-picker-modal.props.js.map +1 -1
- app-rn-runtime/components/input/number/number.component.js +6 -3
- app-rn-runtime/components/input/number/number.component.js.map +1 -1
- app-rn-runtime/components/input/radioset/radioset.component.js +6 -6
- app-rn-runtime/components/input/radioset/radioset.component.js.map +1 -1
- app-rn-runtime/components/input/select/select.component.js +23 -9
- app-rn-runtime/components/input/select/select.component.js.map +1 -1
- app-rn-runtime/components/input/switch/switch.component.js +2 -2
- app-rn-runtime/components/input/switch/switch.component.js.map +1 -1
- app-rn-runtime/components/input/toggle/toggle.component.js +2 -4
- app-rn-runtime/components/input/toggle/toggle.component.js.map +1 -1
- app-rn-runtime/components/navigation/appnavbar/appnavbar.component.js +2 -2
- app-rn-runtime/components/navigation/appnavbar/appnavbar.component.js.map +1 -1
- app-rn-runtime/components/navigation/basenav/basenav.component.js.map +1 -1
- app-rn-runtime/components/navigation/navitem/navitem.component.js +2 -3
- app-rn-runtime/components/navigation/navitem/navitem.component.js.map +1 -1
- app-rn-runtime/components/navigation/popover/popover.component.js.map +1 -1
- app-rn-runtime/components/page/tabbar/curve.js.map +1 -1
- app-rn-runtime/components/page/tabbar/tabbar.component.js.map +1 -1
- app-rn-runtime/core/base.component.js +2 -1
- app-rn-runtime/core/base.component.js.map +1 -1
- app-rn-runtime/core/components/textinput.component.js +4 -3
- app-rn-runtime/core/components/textinput.component.js.map +1 -1
- app-rn-runtime/core/formatters.js.map +1 -1
- app-rn-runtime/core/key.extractor.js.map +1 -1
- app-rn-runtime/core/props.provider.js +3 -0
- app-rn-runtime/core/props.provider.js.map +1 -1
- app-rn-runtime/core/storage.service.js.map +1 -1
- app-rn-runtime/core/tappable.component.js +26 -25
- app-rn-runtime/core/tappable.component.js.map +1 -1
- app-rn-runtime/core/ui-preferences.context.js +7 -0
- app-rn-runtime/core/ui-preferences.context.js.map +1 -0
- app-rn-runtime/core/utils.js +66 -4
- app-rn-runtime/core/utils.js.map +1 -1
- app-rn-runtime/package.json +28 -7
- app-rn-runtime/runtime/App.js +2 -1
- app-rn-runtime/runtime/App.js.map +1 -1
- app-rn-runtime/runtime/App.navigator.js.map +1 -1
- app-rn-runtime/runtime/base-fragment.component.js +15 -0
- app-rn-runtime/runtime/base-fragment.component.js.map +1 -1
- app-rn-runtime/runtime/base-page.component.js.map +1 -1
- app-rn-runtime/runtime/base-prefab.component.js.map +1 -1
- app-rn-runtime/runtime/navigator/stack.navigator.js.map +1 -1
- app-rn-runtime/runtime/services/app-i18n.service.js +10 -0
- app-rn-runtime/runtime/services/app-i18n.service.js.map +1 -1
- app-rn-runtime/runtime/services/app-security.service.js.map +1 -1
- app-rn-runtime/runtime/services/app-spinner.service.js +1 -1
- app-rn-runtime/runtime/services/app-spinner.service.js.map +1 -1
- app-rn-runtime/runtime/services/webprocess.service.js.map +1 -1
- app-rn-runtime/runtime/watcher.js.map +1 -1
- app-rn-runtime/styles/background.component.js +1 -0
- app-rn-runtime/styles/background.component.js.map +1 -1
- app-rn-runtime/styles/style-prop.validator.js.map +1 -1
- app-rn-runtime/styles/theme.js.map +1 -1
- app-rn-runtime/variables/base-variable.js.map +1 -1
- app-rn-runtime/variables/device/file/upload-file.operation.js.map +1 -1
- app-rn-runtime/variables/device-variable.js.map +1 -1
- app-rn-runtime/variables/service-variable.js.map +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["includes","intersection","isNaN","isFinite","toArray","isNil","BaseComponent","BaseComponentState","DEFAULT_CLASS","Platform","countDecimalDigits","validateField","BaseNumberState","constructor","args","_defineProperty","BaseNumberComponent","props","defaultClass","defaultProps","defaultState","DECIMAL","GROUP","onChange","event","state","updateon","updateDatavalue","target","value","focus","_this$widgetRef","widgetRef","validateOnDevice","type","_value$match","isCurrencyField","isValidText","test","Number","match","length","onChangeText","isValidTextOnDevice","decimalPlacesInNumber","decimalPlaces","updateState","textValue","validate","invokeChange","e","OS","cursor","selectionStart","setState","validationObj","isValid","errorType","handleValidation","regexp","condition","RegExp","parseNumber","val","parts","split","NaN","number","join","decimal","sum","parseFloat","toFixed","Object","is","source","model","toString","oldValue","datavalue","validNumber","isValidNumber","invokeEventCallback","proxy","onFieldChange","onBlur","newVal","undefined","setTimeout","triggerValidation","oldVal","onFocus","countDecimals","decimalValue","validateInputEntry","$event","ctrlKey","key","validity","inputValue","step","preventDefault","getValueInRange","minvalue","maxvalue","required","isInteger","resetValidations","onPropertyChange","name","$new","$old","isDefault","bind"],"sources":["basenumber.component.ts"],"sourcesContent":["import { includes, intersection, isNaN, isFinite, toArray, isNil } from 'lodash';\nimport BaseNumberProps from '@wavemaker/app-rn-runtime/components/input/basenumber/basenumber.props';\nimport { BaseComponent, BaseComponentState } from \"@wavemaker/app-rn-runtime/core/base.component\";\nimport { BaseNumberStyles } from '@wavemaker/app-rn-runtime/components/input/basenumber/basenumber.styles';\nimport { DEFAULT_CLASS } from \"@wavemaker/app-rn-runtime/components/navigation/basenav/basenav.styles\";\nimport { Platform, TextInput } from 'react-native';\nimport { countDecimalDigits, validateField } from '@wavemaker/app-rn-runtime/core/utils';\n\nexport class BaseNumberState <T extends BaseNumberProps> extends BaseComponentState<T> {\n isValid: boolean = true;\n textValue: string = '';\n isDefault = false;\n errorType = '';\n}\n\nexport abstract class BaseNumberComponent< T extends BaseNumberProps, S extends BaseNumberState<T>, L extends BaseNumberStyles> extends BaseComponent<T, S, L> {\n private DECIMAL;\n private GROUP;\n public widgetRef: TextInput | null = null;\n private cursor: any = 0;\n constructor(props: T, public defaultClass: string = DEFAULT_CLASS, defaultProps?: T, defaultState?: S) {\n super(props, defaultClass, defaultProps, defaultState);\n this.DECIMAL = '.';\n this.GROUP = ',';\n }\n\n onChange(event: any) {\n if (this.state.props.updateon === 'default') {\n this.updateDatavalue(event.target.value, event);\n }\n }\n\n focus() {\n this?.widgetRef?.focus();\n }\n\n validateOnDevice(value: string, type: 'number' | 'currency') {\n const isCurrencyField = type === 'currency';\n let isValidText = true;\n\n // * no alphabets except E, may contain E only once\n if (/[a-df-zA-DF-Z]/.test(value) || !/^[^eE]*[eE]?[^eE]*$/.test(value)) {\n isValidText = false;\n }\n\n // * currency only: check for negative number\n if (isCurrencyField && (Number(value) < 0 || /-/g.test(value))) {\n isValidText = false;\n }\n\n // * number only: not more than one minus and doesn't end with minus (-)\n if (!isCurrencyField && (Number(value.match(/-/g)?.length) > 1) || /\\w-/.test(value)) {\n isValidText = false;\n }\n\n // * check for more than one decimal point\n if (/^\\d*\\.\\d*\\..*$/.test(value)) {\n isValidText = false;\n }\n\n // * check for spaces and comma\n if (/[\\s,]/.test(value)) {\n isValidText = false;\n }\n\n return isValidText;\n }\n\n onChangeText(value: string, type: 'number' | 'currency') {\n const isValidTextOnDevice = this.validateOnDevice(value, type);\n if (!isValidTextOnDevice) {\n return;\n }\n\n const decimalPlacesInNumber = countDecimalDigits(value);\n\n if (this.props.decimalPlaces < decimalPlacesInNumber) {\n return;\n }\n\n this.updateState({\n textValue: value\n } as S, () => {\n if (this.state.props.updateon === 'default') {\n this.validate(value);\n this.updateDatavalue(value, null);\n }\n }\n );\n }\n\n invokeChange(e: any) {\n if (Platform.OS === 'web') {\n this.cursor = e.target.selectionStart;\n this.setState({ textValue: e.target.value });\n }\n }\n\n validate(value: any) {\n const validationObj = validateField(this.state.props, value);\n this.updateState({\n isValid: validationObj.isValid,\n errorType: validationObj.errorType\n } as S);\n\n }\n\n handleValidation(value: any) {\n const props = this.state.props;\n if (props.regexp) {\n const condition = new RegExp(props.regexp, 'g');\n return condition.test(value);\n }\n return true;\n }\n\n /**\n * Method parses the Localized number(string) to a valid number.\n * if the string dose not result to a valid number then returns NaN.\n * @param {string} val Localized number.\n * @returns {number}\n */\n private parseNumber(val: string): any {\n // splits string into two parts. decimal and number.\n const parts = val.split(this.DECIMAL);\n if (!parts.length) {\n return;\n }\n if (parts.length > 2) {\n return NaN;\n }\n // If number have decimal point and not have a decimal value then return.\n if (parts[1] === '') {\n return NaN;\n }\n // replaces all group separators form the number.\n const number = Number(parts[0].split(this.GROUP).join(''));\n const decimal = Number(`0.${parts[1] || 0}`);\n if (Number.isNaN(number) || Number.isNaN(decimal)) {\n return NaN;\n }\n const sum = parts.length > 1 ? parseFloat((number + decimal).toFixed(parts[1].length)) : number + decimal;\n // if the number is negative then calculate the number as number - decimal\n // Ex: number = -123 and decimal = 0.45 then number - decimal = -123-045 = -123.45\n // If entered number is -0.1 to -0.9 then the number is -0 and decimal is 0.1 to 0.9. Now calaculate the number as number-decimal\n // Ex: number = -0 and decimal = 0.1 then number-decimal = -0-0.1 = -0.1\n if (number === 0) {\n return Object.is(0, number) ? sum : number - decimal;\n }\n return number > 0 ? sum : number - decimal;\n }\n\n updateDatavalue(value: any, event?: any, source?: any) {\n const model = value && this.parseNumber(value.toString());\n const props = this.state.props;\n const oldValue = props.datavalue;\n if (value === oldValue) {\n return;\n }\n const validNumber = this.isValidNumber(model) || value == oldValue + '.';\n if (!validNumber) {\n this.invokeEventCallback('onError', [ event, this.proxy, value, oldValue ]);\n return;\n }\n\n this.updateState({\n props: {\n datavalue: model || Number(value)\n }\n } as S, () => {\n !this.props.onFieldChange && value !== oldValue && this.invokeEventCallback('onChange', [event, this.proxy, model, oldValue]);\n if (source === 'blur') {\n this.invokeEventCallback('onBlur', [event, this.proxy]);\n }\n });\n }\n\n onBlur(event: any) {\n let newVal = event.target.value || this.state.textValue;\n this.validate(newVal);\n if (newVal === '' || newVal == undefined) {\n setTimeout(() => {\n this.props.triggerValidation && this.props.triggerValidation();\n },10)\n }\n if (this.state.props.updateon === 'blur') {\n let oldVal = this.state.props.datavalue || '';\n if (oldVal !== newVal) {\n this.updateDatavalue(newVal, event, 'blur');\n } else {\n this.invokeEventCallback('onBlur', [event, this.proxy]);\n }\n }\n }\n\n onFocus(event: any) {\n this.invokeEventCallback('onFocus', [ event, this.proxy]);\n }\n\n /**\n * returns the number of decimal places a number have.\n * @param value: number\n * @returns {number}\n */\n private countDecimals(value: any) {\n if (value && ((value % 1) !== 0)) {\n const decimalValue = value.toString().split('.')[1];\n return decimalValue && decimalValue.length;\n }\n return 0;\n }\n\n public validateInputEntry($event: any) {\n const props = this.state.props;\n\n // allow actions if control key is pressed or if backspace is pressed. (for Mozilla).\n if ($event.ctrlKey || includes(['Backspace', 'ArrowRight', 'ArrowLeft', 'Tab', 'Enter', 'Delete'], $event.key)) {\n return;\n }\n\n const validity = new RegExp(`^[\\\\d\\\\s-,.e+${this.GROUP}${this.DECIMAL}]$`, 'i');\n const inputValue = $event.target.value;\n // validates entering of decimal values only when user provides decimal limit(i.e step contains decimal values).\n if (inputValue && this.countDecimals(props.step) && (this.countDecimals(inputValue) >= this.countDecimals(props.step))) {\n $event.preventDefault();\n }\n // validates if user entered an invalid character.\n if (!validity.test($event.key)) {\n $event.preventDefault();\n }\n // a decimal value can be entered only once in the input.\n if (includes(inputValue, this.DECIMAL) && $event.key === this.DECIMAL) {\n $event.preventDefault();\n }\n // 'e' can be entered only once in the input.\n if (intersection(toArray(inputValue), ['e', 'E']).length && includes('eE', $event.key)) {\n $event.preventDefault();\n }\n if ((includes(inputValue, '+') || includes(inputValue, '-')) && ($event.key === '+' || $event.key === '-')) {\n $event.preventDefault();\n }\n this.invokeEventCallback('onKeypress', [ $event, this.proxy]);\n }\n\n /**\n * returns a valid number by validating the minimum and maximum values.\n * @param {number} value\n * @returns {number}\n */\n private getValueInRange(value: number): number {\n const props = this.state.props;\n if (!isNil(value) && !isNaN(props.minvalue) && value < props.minvalue) {\n this.updateState({ errorType: 'minvalue'} as S);\n return props.minvalue;\n }\n if (!isNil(value) && !isNaN(props.maxvalue) && value > props.maxvalue) {\n this.updateState({ errorType: 'maxvalue'} as S);\n return props.maxvalue;\n }\n return value;\n }\n\n /**\n * Adds validations for the number before updating the widget model. like validating min and max value for the widget.\n * @param {number} val number to be validated\n * @returns {number}\n */\n private isValidNumber(val: number): boolean {\n const props = this.state.props;\n\n //empty number widget should not show validation error when required is false\n // @ts-ignore\n if (this.state.props.required === false && val === '') {\n return true;\n }\n // id number is infinite then consider it as invalid value\n if (isNaN(val) || !isFinite(val) || (!Number.isInteger(props.step) &&\n this.countDecimals(val) > this.countDecimals(props.step))) {\n this.updateState({\n isValid: false,\n } as S);\n return false;\n }\n if (val !== this.getValueInRange(val)) {\n this.updateState({\n isValid: false,\n } as S);\n return true;\n }\n this.resetValidations();\n return true;\n }\n\n // resets all the flags related to the widget's validation.\n protected resetValidations() {\n this.updateState({\n isValid: true,\n } as S);\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'minvalue':\n case 'maxvalue':\n if ($new|| $old) {\n this.isValidNumber($new);\n }\n break;\n case 'datavalue':\n this.updateState({\n textValue: $new,\n } as S);\n const isDefault = this.state.isDefault;\n if (isDefault) {\n this.updateState({ isDefault: false } as S, this.props.onFieldChange && this.props.onFieldChange.bind(this, 'datavalue', $new, $old, isDefault));\n } else {\n this.props.onFieldChange && this.props.onFieldChange('datavalue', $new, $old, isDefault);\n }\n }\n }\n}\n"],"mappings":";;;AAAA,SAASA,QAAQ,EAAEC,YAAY,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,KAAK,QAAQ,QAAQ;AAEhF,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AAEjG,SAASC,aAAa,QAAQ,wEAAwE;AACtG,SAASC,QAAQ,QAAmB,cAAc;AAClD,SAASC,kBAAkB,EAAEC,aAAa,QAAQ,sCAAsC;AAExF,OAAO,MAAMC,eAAe,SAAqCL,kBAAkB,CAAI;EAAAM,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,kBAClE,IAAI;IAAAA,eAAA,oBACH,EAAE;IAAAA,eAAA,oBACV,KAAK;IAAAA,eAAA,oBACL,EAAE;EAAA;AAChB;AAEA,OAAO,MAAeC,mBAAmB,SAA+FV,aAAa,CAAU;EAK7JO,WAAWA,CAACI,KAAQ,EAASC,YAAoB,GAAGV,aAAa,EAAEW,YAAgB,EAAEC,YAAgB,EAAE;IACrG,KAAK,CAACH,KAAK,EAAEC,YAAY,EAAEC,YAAY,EAAEC,YAAY,CAAC;IAAC,KAD5BF,YAAoB,GAApBA,YAAoB;IAAAH,eAAA;IAAAA,eAAA;IAAAA,eAAA,oBAFZ,IAAI;IAAAA,eAAA,iBACnB,CAAC;IAGrB,IAAI,CAACM,OAAO,GAAG,GAAG;IAClB,IAAI,CAACC,KAAK,GAAG,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AI,CAACnE,KAAK,CAACmE,aAAa,CAAC6B,IAAI,CAAC,IAAI,EAAE,WAAW,EAAEH,IAAI,EAAEC,IAAI,EAAEC,SAAS,CAAC,CAAC;QAClJ,CAAC,MAAM;UACL,IAAI,CAAC/F,KAAK,CAACmE,aAAa,IAAI,IAAI,CAACnE,KAAK,CAACmE,aAAa,CAAC,WAAW,EAAE0B,IAAI,EAAEC,IAAI,EAAEC,SAAS,CAAC;QAC1F;IACJ;EACF;AACF","ignoreList":[]}
|
1
|
+
{"version":3,"names":["includes","intersection","isNaN","isFinite","toArray","isNil","BaseComponent","BaseComponentState","DEFAULT_CLASS","Platform","countDecimalDigits","validateField","BaseNumberState","constructor","args","_defineProperty","BaseNumberComponent","props","defaultClass","defaultProps","defaultState","DECIMAL","GROUP","onChange","event","state","updateon","updateDatavalue","target","value","focus","_this$widgetRef","widgetRef","validateOnDevice","type","_value$match","isCurrencyField","isValidText","test","Number","match","length","onChangeText","shouldFormateToNumber","newValue","parseNumber","replace","isValidTextOnDevice","decimalPlacesInNumber","decimalPlaces","updateState","textValue","validate","invokeChange","e","OS","cursor","selectionStart","setState","validationObj","isValid","errorType","handleValidation","regexp","condition","RegExp","val","parts","split","NaN","number","join","decimal","sum","parseFloat","toFixed","Object","is","source","model","toString","oldValue","datavalue","validNumber","isValidNumber","invokeEventCallback","proxy","Promise","resolve","hastwowaybinding","setProp","then","onFieldChange","onBlur","isDisplayValuePresent","newVal","undefined","setTimeout","triggerValidation","oldVal","onFocus","countDecimals","decimalValue","validateInputEntry","$event","ctrlKey","key","validity","inputValue","step","preventDefault","getValueInRange","minvalue","maxvalue","required","isInteger","resetValidations","onPropertyChange","name","$new","$old","isDefault","bind","displayValue"],"sources":["basenumber.component.ts"],"sourcesContent":["import { includes, intersection, isNaN, isFinite, toArray, isNil } from 'lodash';\nimport BaseNumberProps from '@wavemaker/app-rn-runtime/components/input/basenumber/basenumber.props';\nimport { BaseComponent, BaseComponentState } from \"@wavemaker/app-rn-runtime/core/base.component\";\nimport { BaseNumberStyles } from '@wavemaker/app-rn-runtime/components/input/basenumber/basenumber.styles';\nimport { DEFAULT_CLASS } from \"@wavemaker/app-rn-runtime/components/navigation/basenav/basenav.styles\";\nimport { Platform, TextInput } from 'react-native';\nimport { countDecimalDigits, validateField } from '@wavemaker/app-rn-runtime/core/utils';\n\nexport class BaseNumberState <T extends BaseNumberProps> extends BaseComponentState<T> {\n isValid: boolean = true;\n textValue: string = '';\n isDefault = false;\n errorType = '';\n}\n\nexport abstract class BaseNumberComponent< T extends BaseNumberProps, S extends BaseNumberState<T>, L extends BaseNumberStyles> extends BaseComponent<T, S, L> {\n private DECIMAL;\n private GROUP;\n public widgetRef: TextInput | null = null;\n private cursor: any = 0;\n constructor(props: T, public defaultClass: string = DEFAULT_CLASS, defaultProps?: T, defaultState?: S) {\n super(props, defaultClass, defaultProps, defaultState);\n this.DECIMAL = '.';\n this.GROUP = ',';\n }\n\n onChange(event: any) {\n if (this.state.props.updateon === 'default') {\n this.updateDatavalue(event.target.value, event);\n }\n }\n\n focus() {\n this?.widgetRef?.focus();\n }\n\n validateOnDevice(value: string, type: 'number' | 'currency') {\n const isCurrencyField = type === 'currency';\n let isValidText = true;\n\n // * no alphabets except E, may contain E only once\n if (/[a-df-zA-DF-Z]/.test(value) || !/^[^eE]*[eE]?[^eE]*$/.test(value)) {\n isValidText = false;\n }\n\n // * currency only: check for negative number\n if (isCurrencyField && (Number(value) < 0 || /-/g.test(value))) {\n isValidText = false;\n }\n\n // * number only: not more than one minus and doesn't end with minus (-)\n if (!isCurrencyField && (Number(value.match(/-/g)?.length) > 1) || /\\w-/.test(value)) {\n isValidText = false;\n }\n\n // * check for more than one decimal point\n if (/^\\d*\\.\\d*\\..*$/.test(value)) {\n isValidText = false;\n }\n\n // * check for spaces and comma\n if (/[\\s,]/.test(value)) {\n isValidText = false;\n }\n\n return isValidText;\n }\n\n onChangeText(value: string, type: 'number' | 'currency', shouldFormateToNumber?: boolean) {\n const newValue = shouldFormateToNumber ? `${this.parseNumber(value.replace(/[^0-9.]/g, ''))}` : value;\n const isValidTextOnDevice = this.validateOnDevice(newValue, type);\n if (!isValidTextOnDevice) {\n return;\n }\n\n const decimalPlacesInNumber = countDecimalDigits(newValue);\n\n if (this.props.decimalPlaces < decimalPlacesInNumber) {\n return;\n }\n\n this.updateState({\n textValue: newValue\n } as S, () => {\n if (this.state.props.updateon === 'default') {\n this.validate(newValue);\n this.updateDatavalue(newValue, null);\n }\n }\n );\n }\n\n invokeChange(e: any) {\n if (Platform.OS === 'web') {\n this.cursor = e.target.selectionStart;\n this.setState({ textValue: e.target.value });\n }\n }\n\n validate(value: any) {\n const validationObj = validateField(this.state.props, value);\n this.updateState({\n isValid: validationObj.isValid,\n errorType: validationObj.errorType\n } as S);\n\n }\n\n handleValidation(value: any) {\n const props = this.state.props;\n if (props.regexp) {\n const condition = new RegExp(props.regexp, 'g');\n return condition.test(value);\n }\n return true;\n }\n\n /**\n * Method parses the Localized number(string) to a valid number.\n * if the string dose not result to a valid number then returns NaN.\n * @param {string} val Localized number.\n * @returns {number}\n */\n private parseNumber(val: string): any {\n // splits string into two parts. decimal and number.\n const parts = val.split(this.DECIMAL);\n if (!parts.length) {\n return;\n }\n if (parts.length > 2) {\n return NaN;\n }\n // If number have decimal point and not have a decimal value then return.\n if (parts[1] === '') {\n return NaN;\n }\n // replaces all group separators form the number.\n const number = Number(parts[0].split(this.GROUP).join(''));\n const decimal = Number(`0.${parts[1] || 0}`);\n if (Number.isNaN(number) || Number.isNaN(decimal)) {\n return NaN;\n }\n const sum = parts.length > 1 ? parseFloat((number + decimal).toFixed(parts[1].length)) : number + decimal;\n // if the number is negative then calculate the number as number - decimal\n // Ex: number = -123 and decimal = 0.45 then number - decimal = -123-045 = -123.45\n // If entered number is -0.1 to -0.9 then the number is -0 and decimal is 0.1 to 0.9. Now calaculate the number as number-decimal\n // Ex: number = -0 and decimal = 0.1 then number-decimal = -0-0.1 = -0.1\n if (number === 0) {\n return Object.is(0, number) ? sum : number - decimal;\n }\n return number > 0 ? sum : number - decimal;\n }\n\n updateDatavalue(value: any, event?: any, source?: any) {\n const model = value && this.parseNumber(value.toString());\n const props = this.state.props;\n const oldValue = props.datavalue;\n if (value === oldValue) {\n return;\n }\n const validNumber = this.isValidNumber(model) || value == oldValue + '.';\n if (!validNumber) {\n this.invokeEventCallback('onError', [ event, this.proxy, value, oldValue ]);\n return;\n }\n\n new Promise((resolve) => {\n if (props.hastwowaybinding) {\n this.setProp(\"datavalue\", value);\n resolve(true);\n } else {\n this.updateState({\n props: {\n datavalue: model || Number(value)\n }\n } as S, () => resolve(true));\n }\n }).then(() => {\n !this.props.onFieldChange && value !== oldValue && this.invokeEventCallback('onChange', [event, this.proxy, model, oldValue]);\n if (source === 'blur') {\n this.invokeEventCallback('onBlur', [event, this.proxy]);\n }\n });\n }\n\n onBlur(event: any, isDisplayValuePresent?: boolean) {\n let newVal = isDisplayValuePresent ? this.state.textValue : event.target.value || this.state.textValue;\n this.validate(newVal);\n if (newVal === '' || newVal == undefined) {\n setTimeout(() => {\n this.props.triggerValidation && this.props.triggerValidation();\n },10)\n }\n if (this.state.props.updateon === 'blur') {\n let oldVal = this.state.props.datavalue || '';\n if (oldVal !== newVal) {\n this.updateDatavalue(newVal, event, 'blur');\n } else {\n this.invokeEventCallback('onBlur', [event, this.proxy]);\n }\n }\n }\n\n onFocus(event: any) {\n this.invokeEventCallback('onFocus', [ event, this.proxy]);\n }\n\n /**\n * returns the number of decimal places a number have.\n * @param value: number\n * @returns {number}\n */\n private countDecimals(value: any) {\n if (value && ((value % 1) !== 0)) {\n const decimalValue = value.toString().split('.')[1];\n return decimalValue && decimalValue.length;\n }\n return 0;\n }\n\n public validateInputEntry($event: any) {\n const props = this.state.props;\n\n // allow actions if control key is pressed or if backspace is pressed. (for Mozilla).\n if ($event.ctrlKey || includes(['Backspace', 'ArrowRight', 'ArrowLeft', 'Tab', 'Enter', 'Delete'], $event.key)) {\n return;\n }\n\n const validity = new RegExp(`^[\\\\d\\\\s-,.e+${this.GROUP}${this.DECIMAL}]$`, 'i');\n const inputValue = $event.target.value;\n // validates entering of decimal values only when user provides decimal limit(i.e step contains decimal values).\n if (inputValue && this.countDecimals(props.step) && (this.countDecimals(inputValue) >= this.countDecimals(props.step))) {\n $event.preventDefault();\n }\n // validates if user entered an invalid character.\n if (!validity.test($event.key)) {\n $event.preventDefault();\n }\n // a decimal value can be entered only once in the input.\n if (includes(inputValue, this.DECIMAL) && $event.key === this.DECIMAL) {\n $event.preventDefault();\n }\n // 'e' can be entered only once in the input.\n if (intersection(toArray(inputValue), ['e', 'E']).length && includes('eE', $event.key)) {\n $event.preventDefault();\n }\n if ((includes(inputValue, '+') || includes(inputValue, '-')) && ($event.key === '+' || $event.key === '-')) {\n $event.preventDefault();\n }\n this.invokeEventCallback('onKeypress', [ $event, this.proxy]);\n }\n\n /**\n * returns a valid number by validating the minimum and maximum values.\n * @param {number} value\n * @returns {number}\n */\n private getValueInRange(value: number): number {\n const props = this.state.props;\n if (!isNil(value) && !isNaN(props.minvalue) && value < props.minvalue) {\n this.updateState({ errorType: 'minvalue'} as S);\n return props.minvalue;\n }\n if (!isNil(value) && !isNaN(props.maxvalue) && value > props.maxvalue) {\n this.updateState({ errorType: 'maxvalue'} as S);\n return props.maxvalue;\n }\n return value;\n }\n\n /**\n * Adds validations for the number before updating the widget model. like validating min and max value for the widget.\n * @param {number} val number to be validated\n * @returns {number}\n */\n private isValidNumber(val: number): boolean {\n const props = this.state.props;\n\n //empty number widget should not show validation error when required is false\n // @ts-ignore\n if (this.state.props.required === false && val === '') {\n return true;\n }\n // id number is infinite then consider it as invalid value\n if (isNaN(val) || !isFinite(val) || (!Number.isInteger(props.step) &&\n this.countDecimals(val) > this.countDecimals(props.step))) {\n this.updateState({\n isValid: false,\n } as S);\n return false;\n }\n if (val !== this.getValueInRange(val)) {\n this.updateState({\n isValid: false,\n } as S);\n return true;\n }\n this.resetValidations();\n return true;\n }\n\n // resets all the flags related to the widget's validation.\n protected resetValidations() {\n this.updateState({\n isValid: true,\n } as S);\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'minvalue':\n case 'maxvalue':\n if ($new|| $old) {\n this.isValidNumber($new);\n }\n break;\n case 'datavalue':\n this.updateState({\n textValue: $new,\n } as S);\n const isDefault = this.state.isDefault;\n if (isDefault) {\n this.updateState({ isDefault: false } as S, this.props.onFieldChange && this.props.onFieldChange.bind(this, 'datavalue', $new, $old, isDefault));\n } else {\n this.props.onFieldChange && this.props.onFieldChange('datavalue', $new, $old, isDefault);\n }\n break;\n case 'displayValue': \n this.updateState({\n displayValue: $new,\n } as any)\n }\n }\n}\n"],"mappings":";;;AAAA,SAASA,QAAQ,EAAEC,YAAY,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,KAAK,QAAQ,QAAQ;AAEhF,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AAEjG,SAASC,aAAa,QAAQ,wEAAwE;AACtG,SAASC,QAAQ,QAAmB,cAAc;AAClD,SAASC,kBAAkB,EAAEC,aAAa,QAAQ,sCAAsC;AAExF,OAAO,MAAMC,eAAe,SAAqCL,kBAAkB,CAAI;EAAAM,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,kBAClE,IAAI;IAAAA,eAAA,oBACH,EAAE;IAAAA,eAAA,oBACV,KAAK;IAAAA,eAAA,oBACL,EAAE;EAAA;AAChB;AAEA,OAAO,MAAeC,mBAAmB,SAA+FV,aAAa,CAAU;EAK7JO,WAAWA,CAACI,KAAQ,EAASC,YAAoB,GAAGV,aAAa,EAAEW,YAAgB,EAAEC,YAAgB,EAAE;IACrG,KAAK,CAACH,KAAK,EAAEC,YAAY,EAAEC,YAAY,EAAEC,YAAY,CAAC;IAAC,KAD5BF,YAAoB,GAApBA,YAAoB;IAAAH,eAAA;IAAAA,eAAA;IAAAA,eAAA,oBAFZ,IAAI;IAAAA,eAAA,iBACnB,CAAC;I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EAEA;EACUA,gBAAgBA,CAAA,EAAG;IAC3B,IAAI,CAAClE,WAAW,CAAC;MACfU,OAAO,EAAE;IACX,CAAM,CAAC;EACT;EAEAyD,gBAAgBA,CAACC,IAAY,EAAEC,IAAS,EAAEC,IAAS,EAAE;IACnD,QAAQF,IAAI;MACV,KAAK,UAAU;MACf,KAAK,UAAU;QACb,IAAIC,IAAI,IAAGC,IAAI,EAAE;UACf,IAAI,CAACpC,aAAa,CAACmC,IAAI,CAAC;QAC1B;QACA;MACF,KAAK,WAAW;QACd,IAAI,CAACrE,WAAW,CAAC;UACfC,SAAS,EAAEoE;QACb,CAAM,CAAC;QACP,MAAME,SAAS,GAAG,IAAI,CAAChG,KAAK,CAACgG,SAAS;QACtC,IAAIA,SAAS,EAAE;UACb,IAAI,CAACvE,WAAW,CAAC;YAAEuE,SAAS,EAAE;UAAM,CAAC,EAAO,IAAI,CAACxG,KAAK,CAAC2E,aAAa,IAAI,IAAI,CAAC3E,KAAK,CAAC2E,aAAa,CAAC8B,IAAI,CAAC,IAAI,EAAE,WAAW,EAAEH,IAAI,EAAEC,IAAI,EAAEC,SAAS,CAAC,CAAC;QAClJ,CAAC,MAAM;UACL,IAAI,CAACxG,KAAK,CAAC2E,aAAa,IAAI,IAAI,CAAC3E,KAAK,CAAC2E,aAAa,CAAC,WAAW,EAAE2B,IAAI,EAAEC,IAAI,EAAEC,SAAS,CAAC;QAC1F;QACA;MACF,KAAK,cAAc;QACjB,IAAI,CAACvE,WAAW,CAAC;UACfyE,YAAY,EAAEJ;QAChB,CAAQ,CAAC;IACb;EACF;AACF","ignoreList":[]}
|
@@ -6,6 +6,7 @@ export default class BaseNumberProps extends BaseProps {
|
|
6
6
|
constructor(...args) {
|
7
7
|
super(...args);
|
8
8
|
_defineProperty(this, "datavalue", void 0);
|
9
|
+
_defineProperty(this, "hastwowaybinding", false);
|
9
10
|
_defineProperty(this, "minvalue", null);
|
10
11
|
_defineProperty(this, "maxvalue", null);
|
11
12
|
_defineProperty(this, "step", 1);
|
@@ -20,6 +21,7 @@ export default class BaseNumberProps extends BaseProps {
|
|
20
21
|
_defineProperty(this, "hint", undefined);
|
21
22
|
_defineProperty(this, "accessibilityrole", void 0);
|
22
23
|
_defineProperty(this, "accessibilitylabelledby", undefined);
|
24
|
+
_defineProperty(this, "displayValue", void 0);
|
23
25
|
}
|
24
26
|
}
|
25
27
|
//# sourceMappingURL=basenumber.props.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["BaseProps","BaseNumberProps","constructor","args","_defineProperty","undefined"],"sources":["basenumber.props.ts"],"sourcesContent":["import {AccessibilityRole} from \"react-native\";\nimport { BaseProps } from '@wavemaker/app-rn-runtime/core/base.component';\n\nexport default class BaseNumberProps extends BaseProps {\n datavalue: any;\n minvalue: number = null as any;\n maxvalue: number = null as any;\n step: number = 1;\n updateon: string = 'blur' as any;\n readonly: boolean = null as any;\n regexp: string = null as any;\n onFieldChange: any;\n required: boolean = false;\n triggerValidation: any;\n decimalPlaces: number = 2;\n accessibilitylabel?: string = undefined;\n hint?: string = undefined;\n accessibilityrole?: AccessibilityRole;\n accessibilitylabelledby?: string = undefined;\n}\n"],"mappings":";;;AACA,SAASA,SAAS,QAAQ,+CAA+C;AAEzE,eAAe,MAAMC,eAAe,SAASD,SAAS,CAAC;EAAAE,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA;IAAAA,eAAA,
|
1
|
+
{"version":3,"names":["BaseProps","BaseNumberProps","constructor","args","_defineProperty","undefined"],"sources":["basenumber.props.ts"],"sourcesContent":["import {AccessibilityRole} from \"react-native\";\nimport { BaseProps } from '@wavemaker/app-rn-runtime/core/base.component';\n\nexport default class BaseNumberProps extends BaseProps {\n datavalue: any;\n hastwowaybinding = false;\n minvalue: number = null as any;\n maxvalue: number = null as any;\n step: number = 1;\n updateon: string = 'blur' as any;\n readonly: boolean = null as any;\n regexp: string = null as any;\n onFieldChange: any;\n required: boolean = false;\n triggerValidation: any;\n decimalPlaces: number = 2;\n accessibilitylabel?: string = undefined;\n hint?: string = undefined;\n accessibilityrole?: AccessibilityRole;\n accessibilitylabelledby?: string = undefined;\n displayValue?: string;\n}\n"],"mappings":";;;AACA,SAASA,SAAS,QAAQ,+CAA+C;AAEzE,eAAe,MAAMC,eAAe,SAASD,SAAS,CAAC;EAAAE,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA;IAAAA,eAAA,2BAElC,KAAK;IAAAA,eAAA,mBACL,IAAI;IAAAA,eAAA,mBACJ,IAAI;IAAAA,eAAA,eACR,CAAC;IAAAA,eAAA,mBACG,MAAM;IAAAA,eAAA,mBACL,IAAI;IAAAA,eAAA,iBACP,IAAI;IAAAA,eAAA;IAAAA,eAAA,mBAED,KAAK;IAAAA,eAAA;IAAAA,eAAA,wBAED,CAAC;IAAAA,eAAA,6BACKC,SAAS;IAAAD,eAAA,eACvBC,SAAS;IAAAD,eAAA;IAAAA,eAAA,kCAEUC,SAAS;IAAAD,eAAA;EAAA;AAE9C","ignoreList":[]}
|
@@ -53,13 +53,11 @@ export default class WmCheckbox extends BaseComponent {
|
|
53
53
|
});
|
54
54
|
}
|
55
55
|
onPress() {
|
56
|
-
if (
|
57
|
-
this.invokeEventCallback('onFocus', [null, this.proxy]);
|
58
|
-
}
|
59
|
-
this.invokeEventCallback('onTap', [null, this.proxy]);
|
60
|
-
if (this.state.props.disabled) {
|
56
|
+
if (this.state.props.disabled || this.state.props.readonly) {
|
61
57
|
return;
|
62
58
|
}
|
59
|
+
this.invokeEventCallback('onFocus', [null, this.proxy]);
|
60
|
+
this.invokeEventCallback('onTap', [null, this.proxy]);
|
63
61
|
const oldValue = this.state.props.datavalue;
|
64
62
|
const value = !this.state.isChecked;
|
65
63
|
this.validate(value);
|
@@ -93,7 +91,8 @@ export default class WmCheckbox extends BaseComponent {
|
|
93
91
|
}), this._background, /*#__PURE__*/React.createElement(WmIcon, {
|
94
92
|
iconclass: "wi wi-check",
|
95
93
|
styles: this.state.isChecked ? this.styles.checkicon : this.styles.uncheckicon,
|
96
|
-
disabled: props.readonly || props.disabled
|
94
|
+
disabled: props.readonly || props.disabled,
|
95
|
+
id: this.getTestId('checkbox')
|
97
96
|
}), /*#__PURE__*/React.createElement(Text, _extends({}, this.getTestPropsForLabel(), {
|
98
97
|
style: this.styles.text
|
99
98
|
}), props.caption));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","Text","TouchableOpacity","BaseComponent","BaseComponentState","WmIcon","unStringify","validateField","WmCheckboxProps","DEFAULT_CLASS","AccessibilityWidgetType","getAccessibilityProps","WmCheckboxState","constructor","args","_defineProperty","WmCheckbox","props","setChecked","dataValue","checkedvalue","value","updateState","isChecked","onPropertyChange","name","$new","$old","state","datavalue","updateDatavalue","validate","validationObj","isValid","errorType","onPress","readonly","invokeEventCallback","proxy","
|
1
|
+
{"version":3,"names":["React","Text","TouchableOpacity","BaseComponent","BaseComponentState","WmIcon","unStringify","validateField","WmCheckboxProps","DEFAULT_CLASS","AccessibilityWidgetType","getAccessibilityProps","WmCheckboxState","constructor","args","_defineProperty","WmCheckbox","props","setChecked","dataValue","checkedvalue","value","updateState","isChecked","onPropertyChange","name","$new","$old","state","datavalue","updateDatavalue","validate","validationObj","isValid","errorType","onPress","disabled","readonly","invokeEventCallback","proxy","oldValue","uncheckedvalue","onFieldChange","renderWidget","createElement","_extends","getTestPropsForAction","style","styles","root","bind","CHECKBOX","hint","checked","accessibilityRole","accessibilityLabel","caption","_background","iconclass","checkicon","uncheckicon","id","getTestId","getTestPropsForLabel","text"],"sources":["checkbox.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, TouchableOpacity } from 'react-native';\n\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';\nimport {unStringify, validateField} from '@wavemaker/app-rn-runtime/core/utils';\n\nimport WmCheckboxProps from './checkbox.props';\nimport { DEFAULT_CLASS, WmCheckboxStyles } from './checkbox.styles';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility';\n\nexport class WmCheckboxState extends BaseComponentState<WmCheckboxProps> {\n isChecked: boolean = false;\n isValid: boolean = true;\n errorType = '';\n}\n\nexport default class WmCheckbox extends BaseComponent<WmCheckboxProps, WmCheckboxState, WmCheckboxStyles> {\n\n constructor(props: WmCheckboxProps) {\n super(props, DEFAULT_CLASS, new WmCheckboxProps(), new WmCheckboxState());\n }\n\n setChecked(dataValue: any, checkedvalue: any) {\n const value = unStringify(dataValue) === unStringify(checkedvalue, true);\n this.updateState({ isChecked: value } as WmCheckboxState);\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'checkedvalue':\n this.setChecked(this.state.props.datavalue, $new);\n break;\n case 'datavalue':\n this.setChecked($new, this.state.props.checkedvalue);\n break;\n }\n }\n\n updateDatavalue(value: any) {\n this.updateState({ props: { datavalue: value }} as WmCheckboxState);\n }\n validate(value: any) {\n const validationObj = validateField(this.state.props, value);\n this.updateState({\n isValid: validationObj.isValid,\n errorType: validationObj.errorType\n } as WmCheckboxState);\n }\n\n onPress() {\n if (this.state.props.disabled || this.state.props.readonly) {\n return;\n }\n this.invokeEventCallback('onFocus', [null, this.proxy]);\n this.invokeEventCallback('onTap', [null, this.proxy]);\n const oldValue = this.state.props.datavalue;\n const value = !this.state.isChecked;\n this.validate(value);\n this.updateState({ isChecked: value } as WmCheckboxState);\n const dataValue = value === true ? this.state.props.checkedvalue : this.state.props.uncheckedvalue;\n this.updateState({ props: { datavalue: dataValue } } as WmCheckboxState,\n () => {\n if (!this.props.onFieldChange) {\n this.invokeEventCallback('onChange', [null, this.proxy, dataValue, oldValue]);\n } else {\n this.props.onFieldChange && this.props.onFieldChange('datavalue', dataValue, oldValue);\n }\n this.invokeEventCallback('onBlur', [ null, this.proxy ]);\n });\n }\n\n renderWidget(props: WmCheckboxProps) {\n return (\n <TouchableOpacity {...this.getTestPropsForAction()} style={this.styles.root} onPress={this.onPress.bind(this)} {...getAccessibilityProps(AccessibilityWidgetType.CHECKBOX, {hint: props?.hint, checked: this.state.isChecked})} accessibilityRole='checkbox' accessibilityLabel={`Checkbox for ${props.caption}`}>\n {this._background}\n <WmIcon iconclass=\"wi wi-check\" styles={this.state.isChecked ? this.styles.checkicon : this.styles.uncheckicon} disabled={props.readonly || props.disabled} id={this.getTestId('checkbox')}/>\n <Text {...this.getTestPropsForLabel()} style={this.styles.text}>{props.caption}</Text>\n </TouchableOpacity>\n );\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,gBAAgB,QAAQ,cAAc;AAErD,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AACjG,OAAOC,MAAM,MAAM,gEAAgE;AACnF,SAAQC,WAAW,EAAEC,aAAa,QAAO,sCAAsC;AAE/E,OAAOC,eAAe,MAAM,kBAAkB;AAC9C,SAASC,aAAa,QAA0B,mBAAmB;AACnE,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,8CAA8C;AAE7G,OAAO,MAAMC,eAAe,SAASR,kBAAkB,CAAkB;EAAAS,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,oBAClD,KAAK;IAAAA,eAAA,kBACP,IAAI;IAAAA,eAAA,oBACX,EAAE;EAAA;AAChB;AAEA,eAAe,MAAMC,UAAU,SAASb,aAAa,CAAqD;EAExGU,WAAWA,CAACI,KAAsB,EAAE;IAClC,KAAK,CAACA,KAAK,EAAER,aAAa,EAAE,IAAID,eAAe,CAAC,CAAC,EAAE,IAAII,eAAe,CAAC,CAAC,CAAC;EAC3E;EAEAM,UAAUA,CAACC,SAAc,EAAEC,YAAiB,EAAE;IAC5C,MAAMC,KAAK,GAAGf,WAAW,CAACa,SAAS,CAAC,KAAKb,WAAW,CAACc,YAAY,EAAE,IAAI,CAAC;IACxE,IAAI,CAACE,WA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C;MAAE+B,iBAAiB,EAAC,UAAU;MAACC,kBAAkB,EAAE,gBAAgBtC,KAAK,CAACuC,OAAO;IAAG,IAC5S,IAAI,CAACC,WAAW,eACjBzD,KAAA,CAAA4C,aAAA,CAACvC,MAAM;MAACqD,SAAS,EAAC,aAAa;MAACV,MAAM,EAAE,IAAI,CAACpB,KAAK,CAACL,SAAS,GAAG,IAAI,CAACyB,MAAM,CAACW,SAAS,GAAG,IAAI,CAACX,MAAM,CAACY,WAAY;MAACxB,QAAQ,EAAEnB,KAAK,CAACoB,QAAQ,IAAIpB,KAAK,CAACmB,QAAS;MAACyB,EAAE,EAAE,IAAI,CAACC,SAAS,CAAC,UAAU;IAAE,CAAC,CAAC,eAC7L9D,KAAA,CAAA4C,aAAA,CAAC3C,IAAI,EAAA4C,QAAA,KAAK,IAAI,CAACkB,oBAAoB,CAAC,CAAC;MAAEhB,KAAK,EAAE,IAAI,CAACC,MAAM,CAACgB;IAAK,IAAE/C,KAAK,CAACuC,OAAc,CACvE,CAAC;EAEvB;AACF","ignoreList":[]}
|
@@ -23,10 +23,10 @@ export default class WmCheckboxset extends BaseDatasetComponent {
|
|
23
23
|
super(props, DEFAULT_CLASS, new WmCheckboxsetProps());
|
24
24
|
}
|
25
25
|
onPress(item) {
|
26
|
-
this.invokeEventCallback('onTap', [null, this.proxy]);
|
27
26
|
if (this.state.props.disabled || this.state.props.readonly) {
|
28
27
|
return;
|
29
28
|
}
|
29
|
+
this.invokeEventCallback('onTap', [null, this.proxy]);
|
30
30
|
item.selected = !item.selected;
|
31
31
|
const selectedValue = [];
|
32
32
|
const selectedItem = find(this.state.dataItems, d => isEqual(d.key, item.key));
|
@@ -65,7 +65,8 @@ export default class WmCheckboxset extends BaseDatasetComponent {
|
|
65
65
|
}), /*#__PURE__*/React.createElement(WmIcon, {
|
66
66
|
iconclass: "wi wi-check",
|
67
67
|
styles: item.selected ? this.styles.checkicon : this.styles.uncheckicon,
|
68
|
-
disabled: props.readonly || props.disabled
|
68
|
+
disabled: props.readonly || props.disabled,
|
69
|
+
id: this.getTestId('item' + index)
|
69
70
|
}), !isEmpty(this.state.template) && this.props.renderitempartial ? this.props.renderitempartial(item.dataObject, index, this.state.template) : /*#__PURE__*/React.createElement(Text, _extends({}, this.getTestPropsForLabel(index + ''), {
|
70
71
|
style: this.styles.text
|
71
72
|
}), displayText));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","Text","View","TouchableOpacity","ScrollView","find","forEach","isEqual","isEmpty","WmCheckboxsetProps","DEFAULT_CLASS","BaseDatasetComponent","BaseDatasetState","WmIcon","AccessibilityWidgetType","getAccessibilityProps","WmCheckboxsetState","constructor","args","_defineProperty","WmCheckboxset","props","onPress","item","invokeEventCallback","proxy","state","disabled","readonly","selected","selectedValue","selectedItem","dataItems","d","key","oldValue","datavalue","push","datafield","validate","updateState","computeDisplayValue","undefined","renderChild","index","colWidth","displayText","displayexp","displayfield","createElement","_extends","getTestPropsForAction","style","styles","checkedItem","width","bind","CHECKBOX","hint","checked","accessibilityRole","accessibilityLabel","iconclass","checkicon","uncheckicon","template","renderitempartial","dataObject","getTestPropsForLabel","text","displayValue","filter","map","updateDatavalue","value","Promise","resolve","setTemplate","partialName","renderGroupby","groupedData","length","groupObj","groupHeaderTitle","renderCheckboxses","data","items","noOfColumns","itemsperrow","xs","Math","round","flexWrap","flexDirection","renderWidget","root","horizontal","groupby"],"sources":["checkboxset.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, View, TouchableOpacity, DimensionValue } from 'react-native';\nimport { ScrollView } from 'react-native-gesture-handler';\nimport { find, forEach, isEqual, isEmpty } from 'lodash';\nimport WmCheckboxsetProps from './checkboxset.props';\nimport {\n DEFAULT_CLASS,\n\n WmCheckboxsetStyles,\n} from './checkboxset.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 { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility';\n\nexport class WmCheckboxsetState extends BaseDatasetState<WmCheckboxsetProps> {\n isValid: boolean = true;\n template: string = \"\";\n}\n\nexport default class WmCheckboxset extends BaseDatasetComponent<WmCheckboxsetProps, WmCheckboxsetState, WmCheckboxsetStyles> {\n constructor(props: WmCheckboxsetProps) {\n super(props, DEFAULT_CLASS, new WmCheckboxsetProps());\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 = !item.selected;\n const 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 forEach(this.state.dataItems, (item) => {\n if (item.selected) {\n selectedValue.push(item.datafield);\n }\n });\n this.validate(selectedValue);\n this.updateState({ props: { datavalue: selectedValue }} as WmCheckboxsetState,\n () => {\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 props = this.state.props;\n const displayText = item.displayexp || item.displayfield;\n return (\n <TouchableOpacity {...this.getTestPropsForAction(index + '')}\n style={[this.styles.item, item.selected ? this.styles.checkedItem : null, {width: colWidth}]}\n onPress={this.onPress.bind(this, item)} key={item.key} {...getAccessibilityProps(AccessibilityWidgetType.CHECKBOX, {hint: props?.hint, checked: item.selected})} accessibilityRole='checkbox' accessibilityLabel={`Checkbox for ${displayText}`}>\n <WmIcon iconclass=\"wi wi-check\" styles={item.selected? this.styles.checkicon : this.styles.uncheckicon} disabled={props.readonly || props.disabled}/>\n {!isEmpty(this.state.template) && this.props.renderitempartial ?\n this.props.renderitempartial(item.dataObject, index, this.state.template) :\n <Text {...this.getTestPropsForLabel(index + '')} style={this.styles.text}>{displayText}</Text>}\n </TouchableOpacity>)\n }\n\n computeDisplayValue() {\n this.updateState({\n props: {\n displayValue: ((this.state.dataItems || [] as any)\n .filter((item: any) => item.selected)\n .map((item: any) => item.displayexp || item.displayfield)) || ''\n }\n } as WmCheckboxsetState);\n }\n\n updateDatavalue(value: any) {\n this.updateState({ props: { datavalue: value }} as WmCheckboxsetState);\n return Promise.resolve();\n }\n\n setTemplate(partialName: any) {\n this.updateState({ template: partialName} as WmCheckboxsetState);\n }\n\n renderGroupby() {\n const groupedData = this.state.groupedData;\n return (\n <View>\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.renderCheckboxses(groupObj.data)}\n </View>)\n })\n : null}\n </View>\n );\n }\n\n renderCheckboxses(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(<View style = { noOfColumns === 1 ? {} : {flexWrap: 'wrap', flexDirection: 'row'}}>\n {items && items.length\n ? items.map((item: any, index: any) => this.renderChild(item, index, colWidth))\n : null}\n </View>)\n }\n renderWidget(props: WmCheckboxsetProps) {\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.renderCheckboxses(items)}\n </ScrollView>\n </ScrollView>\n );\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,gBAAgB,QAAwB,cAAc;AAC3E,SAASC,UAAU,QAAQ,8BAA8B;AACzD,SAASC,IAAI,EAAEC,OAAO,EAAEC,OAAO,EAAGC,OAAO,QAAQ,QAAQ;AACzD,OAAOC,kBAAkB,MAAM,qBAAqB;AACpD,SACEC,aAAa,QAGR,sBAAsB;AAC7B,SACEC,oBAAoB,EACpBC,gBAAgB,QACX,8EAA8E;AACrF,OAAOC,MAAM,M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AAC;EACT;EACAiD,YAAYA,CAACzE,KAAyB,EAAE;IACtC,MAAMiE,KAAK,GAAG,IAAI,CAAC5D,KAAK,CAACM,SAAS;IAClC,oBACEhC,KAAA,CAAAiD,aAAA,CAAC7C,UAAU;MAACgD,KAAK,EAAE,IAAI,CAACC,MAAM,CAAC0C;IAAK,gBAClC/F,KAAA,CAAAiD,aAAA,CAAC7C,UAAU;MAAC4F,UAAU,EAAE;IAAK,GAC1B3E,KAAK,CAAC4E,OAAO,IAAI,IAAI,CAAClB,aAAa,CAAC,CAAC,EACrC,CAAC1D,KAAK,CAAC4E,OAAO,IAAI,IAAI,CAACb,iBAAiB,CAACE,KAAK,CACrC,CACF,CAAC;EAEjB;AACF","ignoreList":[]}
|
1
|
+
{"version":3,"names":["React","Text","View","TouchableOpacity","ScrollView","find","forEach","isEqual","isEmpty","WmCheckboxsetProps","DEFAULT_CLASS","BaseDatasetComponent","BaseDatasetState","WmIcon","AccessibilityWidgetType","getAccessibilityProps","WmCheckboxsetState","constructor","args","_defineProperty","WmCheckboxset","props","onPress","item","state","disabled","readonly","invokeEventCallback","proxy","selected","selectedValue","selectedItem","dataItems","d","key","oldValue","datavalue","push","datafield","validate","updateState","computeDisplayValue","undefined","renderChild","index","colWidth","displayText","displayexp","displayfield","createElement","_extends","getTestPropsForAction","style","styles","checkedItem","width","bind","CHECKBOX","hint","checked","accessibilityRole","accessibilityLabel","iconclass","checkicon","uncheckicon","id","getTestId","template","renderitempartial","dataObject","getTestPropsForLabel","text","displayValue","filter","map","updateDatavalue","value","Promise","resolve","setTemplate","partialName","renderGroupby","groupedData","length","groupObj","groupHeaderTitle","renderCheckboxses","data","items","noOfColumns","itemsperrow","xs","Math","round","flexWrap","flexDirection","renderWidget","root","horizontal","groupby"],"sources":["checkboxset.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, View, TouchableOpacity, DimensionValue } from 'react-native';\nimport { ScrollView } from 'react-native-gesture-handler';\nimport { find, forEach, isEqual, isEmpty } from 'lodash';\nimport WmCheckboxsetProps from './checkboxset.props';\nimport {\n DEFAULT_CLASS,\n\n WmCheckboxsetStyles,\n} from './checkboxset.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 { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility';\n\nexport class WmCheckboxsetState extends BaseDatasetState<WmCheckboxsetProps> {\n isValid: boolean = true;\n template: string = \"\";\n}\n\nexport default class WmCheckboxset extends BaseDatasetComponent<WmCheckboxsetProps, WmCheckboxsetState, WmCheckboxsetStyles> {\n constructor(props: WmCheckboxsetProps) {\n super(props, DEFAULT_CLASS, new WmCheckboxsetProps());\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 = !item.selected;\n const 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 forEach(this.state.dataItems, (item) => {\n if (item.selected) {\n selectedValue.push(item.datafield);\n }\n });\n this.validate(selectedValue);\n this.updateState({ props: { datavalue: selectedValue }} as WmCheckboxsetState,\n () => {\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 props = this.state.props;\n const displayText = item.displayexp || item.displayfield;\n return (\n <TouchableOpacity {...this.getTestPropsForAction(index + '')}\n style={[this.styles.item, item.selected ? this.styles.checkedItem : null, {width: colWidth}]}\n onPress={this.onPress.bind(this, item)} key={item.key} {...getAccessibilityProps(AccessibilityWidgetType.CHECKBOX, {hint: props?.hint, checked: item.selected})} accessibilityRole='checkbox' accessibilityLabel={`Checkbox for ${displayText}`}>\n <WmIcon iconclass=\"wi wi-check\" styles={item.selected? this.styles.checkicon : this.styles.uncheckicon} disabled={props.readonly || props.disabled} id={this.getTestId('item'+index)}/>\n {!isEmpty(this.state.template) && this.props.renderitempartial ?\n this.props.renderitempartial(item.dataObject, index, this.state.template) :\n <Text {...this.getTestPropsForLabel(index + '')} style={this.styles.text}>{displayText}</Text>}\n </TouchableOpacity>)\n }\n\n computeDisplayValue() {\n this.updateState({\n props: {\n displayValue: ((this.state.dataItems || [] as any)\n .filter((item: any) => item.selected)\n .map((item: any) => item.displayexp || item.displayfield)) || ''\n }\n } as WmCheckboxsetState);\n }\n\n updateDatavalue(value: any) {\n this.updateState({ props: { datavalue: value }} as WmCheckboxsetState);\n return Promise.resolve();\n }\n\n setTemplate(partialName: any) {\n this.updateState({ template: partialName} as WmCheckboxsetState);\n }\n\n renderGroupby() {\n const groupedData = this.state.groupedData;\n return (\n <View>\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.renderCheckboxses(groupObj.data)}\n </View>)\n })\n : null}\n </View>\n );\n }\n\n renderCheckboxses(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(<View style = { noOfColumns === 1 ? {} : {flexWrap: 'wrap', flexDirection: 'row'}}>\n {items && items.length\n ? items.map((item: any, index: any) => this.renderChild(item, index, colWidth))\n : null}\n </View>)\n }\n renderWidget(props: WmCheckboxsetProps) {\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.renderCheckboxses(items)}\n </ScrollView>\n </ScrollView>\n );\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,gBAAgB,QAAwB,cAAc;AAC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AAI;MAACkD,KAAK,EAAKqC,WAAW,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG;QAACK,QAAQ,EAAE,MAAM;QAAEC,aAAa,EAAE;MAAK;IAAE,GACtFP,KAAK,IAAIA,KAAK,CAACL,MAAM,GAClBK,KAAK,CAACd,GAAG,CAAC,CAACnD,IAAS,EAAEqB,KAAU,KAAK,IAAI,CAACD,WAAW,CAACpB,IAAI,EAAEqB,KAAK,EAAEC,QAAQ,CAAC,CAAC,GAC7E,IACA,CAAC;EACT;EACAmD,YAAYA,CAAC3E,KAAyB,EAAE;IACtC,MAAMmE,KAAK,GAAG,IAAI,CAAChE,KAAK,CAACQ,SAAS;IAClC,oBACEhC,KAAA,CAAAiD,aAAA,CAAC7C,UAAU;MAACgD,KAAK,EAAE,IAAI,CAACC,MAAM,CAAC4C;IAAK,gBAClCjG,KAAA,CAAAiD,aAAA,CAAC7C,UAAU;MAAC8F,UAAU,EAAE;IAAK,GAC1B7E,KAAK,CAAC8E,OAAO,IAAI,IAAI,CAAClB,aAAa,CAAC,CAAC,EACrC,CAAC5D,KAAK,CAAC8E,OAAO,IAAI,IAAI,CAACb,iBAAiB,CAACE,KAAK,CACrC,CACF,CAAC;EAEjB;AACF","ignoreList":[]}
|
@@ -173,7 +173,7 @@ export default class WmChips extends BaseDatasetComponent {
|
|
173
173
|
style: [this.styles.chip, isSelected ? this.styles.activeChip : null],
|
174
174
|
key: 'chipitem_' + index,
|
175
175
|
onPress: () => {
|
176
|
-
if (this.state.props.disabled) {
|
176
|
+
if (this.state.props.disabled || this.state.props.readonly) {
|
177
177
|
return;
|
178
178
|
}
|
179
179
|
if (this.isDefaultView()) {
|
@@ -190,6 +190,7 @@ export default class WmChips extends BaseDatasetComponent {
|
|
190
190
|
}
|
191
191
|
}
|
192
192
|
}), isSelected && this.isDefaultView() ? /*#__PURE__*/React.createElement(WmIcon, {
|
193
|
+
id: this.getTestId('checkicon'),
|
193
194
|
iconclass: 'wm-sl-l sl-check',
|
194
195
|
iconsize: 16,
|
195
196
|
styles: merge({}, this.styles.doneIcon, {
|
@@ -198,7 +199,7 @@ export default class WmChips extends BaseDatasetComponent {
|
|
198
199
|
}
|
199
200
|
})
|
200
201
|
}) : null, /*#__PURE__*/React.createElement(WmPicture, {
|
201
|
-
id: this.getTestId('picture'),
|
202
|
+
id: this.getTestId('chip' + index + 'picture'),
|
202
203
|
styles: this.styles.imageStyles,
|
203
204
|
picturesource: item.imgSrc,
|
204
205
|
shape: "circle"
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","View","TouchableOpacity","Text","clone","findIndex","get","isUndefined","pull","forEach","filter","find","isEqual","merge","WmChipsProps","DEFAULT_CLASS","WmSearch","BaseDatasetComponent","BaseDatasetState","WmIcon","WmPicture","AccessibilityWidgetType","getAccessibilityProps","WmChipsState","constructor","args","_defineProperty","WmChips","props","onComponentInit","c","searchRef","val","onPropertyChange","name","$new","$old","length","updateState","chipsList","reset","_this$searchRef","state","query","onDataItemsUpdate","isDefaultQuery","updateDefaultQueryModel","addItem","$event","widget","_this$props","_this$props2","newChipList","allowAdd","push","queryModel","isFormFieldWidget","isDuplicate","resetSearchModel","invokeEvent","invokeEventCallback","toBoolean","setDatavalue","computeDisplayValue","displayValue","dataItems","item","selected","map","displayexp","displayfield","selectChip","chipItem","maxsize","selectedItem","d","key","dataValue","datafield","updateDatavalue","updateMaxSize","prevDatavalue","createCustomDataModel","dataObject","isCustom","clearSearch","chipListLength","saturate","removeItem","index","allowRemove","isDefaultView","_this$state$dataItems","searchable","renderChip","isSelected","createElement","_extends","getTestPropsForAction","CHIPS","style","styles","chip","activeChip","onPress","disabled","iconclass","iconsize","doneIcon","icon","color","activeChipLabel","id","getTestId","imageStyles","picturesource","imgSrc","shape","chipLabel","clearIcon","onTap","selectedItems","componentDidMount","componentDidUpdate","prevProps","prevState","_this$searchRef2","computePosition","renderWidget","chips","root","chipsWrapper","searchContainer","flexDirection","inputposition","search","placeholder","maxSizeReached","listener","dataset","searchkey","minchars","autofocus","readonly","displayexpression","getDisplayExpression","displayimagesrc","onSubmit","bind","onChange","_this$props$listener","_this$props$listener2","onComponentChange","showSearchIcon","showclear","type","flexWrap"],"sources":["chips.component.tsx"],"sourcesContent":["import React from 'react';\nimport { View, TouchableOpacity, Text } from 'react-native';\nimport { LifecycleListener } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { clone, findIndex, get, isUndefined, pull, forEach, filter, find, isEqual, merge } from 'lodash';\nimport WmChipsProps from './chips.props';\nimport { DEFAULT_CLASS, WmChipsStyles } from './chips.styles';\nimport WmSearch from '@wavemaker/app-rn-runtime/components/basic/search/search.component';\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 WmPicture from '@wavemaker/app-rn-runtime/components/basic/picture/picture.component';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility'; \n\nexport class WmChipsState extends BaseDatasetState<WmChipsProps> {\n chipsList: any = [];\n saturate: any;\n}\n\nexport default class WmChips extends BaseDatasetComponent<WmChipsProps, WmChipsState, WmChipsStyles> {\n constructor(props: WmChipsProps) {\n super(props, DEFAULT_CLASS, new WmChipsProps(), new WmChipsState());\n }\n\n private searchRef: WmSearch = null as any;\n private maxSizeReached = 'Max size reached';\n private isDefaultQuery: boolean = true;\n private prevDatavalue: any;\n\n private listener: LifecycleListener = {\n onComponentInit: (c) => {\n if (c instanceof WmSearch) {\n this.searchRef = c;\n }\n }\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 (!$new || $new.length === 0) {\n this.updateState({\n chipsList : []\n } as WmChipsState);\n }\n }\n }\n\n reset() {\n if (this.searchRef?.state.props.query) {\n this.searchRef.reset();\n }\n }\n\n onDataItemsUpdate() {\n super.onDataItemsUpdate();\n this.isDefaultQuery = true;\n this.updateDefaultQueryModel();\n }\n\n addItem($event: any, widget: any) {\n let newChipList = clone(this.state.chipsList),\n allowAdd;\n newChipList.push(widget.queryModel);\n const isFormFieldWidget = get(this.props, 'formfield');\n if (this.isDuplicate(widget.queryModel)) {\n this.resetSearchModel();\n return;\n }\n\n // @ts-ignore\n allowAdd = isFormFieldWidget ? this.props?.invokeEvent('onBeforeadd', [null, this, widget.queryModel]) : this.invokeEventCallback('onBeforeadd', [null, this, widget.queryModel]);\n\n if (!isUndefined(allowAdd) && !this.toBoolean(allowAdd)) {\n return;\n }\n\n this.updateState({\n chipsList: newChipList\n } as WmChipsState);\n\n this.setDatavalue(newChipList);\n\n // @ts-ignore\n isFormFieldWidget ? this.props?.invokeEvent('onAdd', [null, this, widget.queryModel]) : this.invokeEventCallback('onAdd', [null, this, widget.queryModel]);\n this.resetSearchModel();\n }\n\n computeDisplayValue() {\n this.updateState({\n props: {\n displayValue: ((this.state.dataItems || [] as any)\n .filter((item: any) => item.selected)\n .map((item: any) => item.displayexp || item.displayfield)) || ''\n }\n } as WmChipsState);\n }\n\n selectChip(chipItem: any) {\n if (!chipItem.selected && this.state.props.maxsize > 0 && (this.state.chipsList.length === this.state.props.maxsize)) {\n return;\n }\n chipItem.selected = !chipItem.selected;\n const newChipList: any = [];\n const selectedItem = find(this.state.dataItems, d => isEqual(d.key, chipItem.key));\n selectedItem.selected = chipItem.selected;\n forEach(this.state.dataItems, (item) => {\n if (item.selected) {\n newChipList.push(item);\n }\n });\n this.updateState({\n chipsList: newChipList\n } as WmChipsState);\n\n this.setDatavalue(newChipList);\n }\n\n setDatavalue(newChipList: any) {\n const dataValue = newChipList.map((item: any) => item.datafield);\n this.updateDatavalue(dataValue);\n this.updateMaxSize(newChipList.length);\n if (!this.props.invokeEvent) {\n this.invokeEventCallback('onChange', [null, this, dataValue, this.prevDatavalue])\n }\n this.prevDatavalue = dataValue;\n }\n\n toBoolean = (val: any) => ((val && val !== 'false') ? true : false);\n\n // Prepare datavalue object from a string(junk) value when datafield is allFields.\n createCustomDataModel(val: string) {\n return {\n key: `${this.state.props.name}_item${this.state.chipsList.length}`,\n dataObject: val,\n displayfield: val,\n datafield: val,\n isCustom: true\n }\n }\n\n resetSearchModel() {\n (this as any).searchRef.isDefaultQuery = false;\n this.searchRef.clearSearch();\n }\n\n isDuplicate(item: any) {\n return findIndex(this.state.chipsList, {datafield: item.datafield}) > -1;\n }\n\n // Check if max size is reached\n private updateMaxSize(chipListLength: number) {\n const saturate = this.state.props.maxsize > 0 && (chipListLength || this.state.chipsList.length) === this.state.props.maxsize;\n this.updateState({\n saturate: saturate\n } as WmChipsState);\n }\n\n removeItem(item: any, index: any) {\n let newChipList = clone(this.state.chipsList);\n const isFormFieldWidget = get(this.props, 'formfield');\n newChipList = pull(newChipList, item);\n // prevent deletion if the before-remove event callback returns false\n // @ts-ignore\n const allowRemove = isFormFieldWidget ? this.props.invokeEvent('onBeforeremove',[null, this, item]) : this.invokeEventCallback('onBeforeremove',[null, this, item]);\n if (!isUndefined(allowRemove) && !this.toBoolean(allowRemove)) {\n return;\n }\n this.updateState({\n chipsList: newChipList\n } as WmChipsState);\n this.setDatavalue(newChipList);\n // @ts-ignore\n isFormFieldWidget ? this.props.invokeEvent('onRemove', [null, this, item]) : this.invokeEventCallback('onRemove', [null, this, item]);\n }\n\n private isDefaultView() {\n return !this.state.props.searchable && this.state.dataItems?.length <= 10;\n }\n\n renderChip(item: any, index: any) {\n const isSelected = this.isDefaultView() ? item.selected : true;\n return (\n <TouchableOpacity\n {...this.getTestPropsForAction('chip'+ index)}\n {...getAccessibilityProps(AccessibilityWidgetType.CHIPS, {...this.state.props, selected: isSelected})}\n style={[this.styles.chip, isSelected ? this.styles.activeChip : null]}\n key={'chipitem_'+ index}\n onPress={() => {\n if (this.state.props.disabled) {\n return;\n }\n if (this.isDefaultView()) {\n this.selectChip(item);\n }\n if (get(this.props, 'formfield')) {\n // @ts-ignore\n this.props.invokeEvent('onChipclick', [null, this, item]);\n // @ts-ignore\n this.props.invokeEvent('onChipselect', [null, this, item]);\n } else {\n this.invokeEventCallback('onChipclick', [null, this, item]);\n this.invokeEventCallback('onChipselect', [null, this, item]);\n }\n }}>\n {isSelected && this.isDefaultView() ? <WmIcon iconclass={'wm-sl-l sl-check'} iconsize={16} styles={merge({}, this.styles.doneIcon, {icon: {color: isSelected ? this.styles.activeChipLabel.color : null}})}></WmIcon> : null}\n <WmPicture id={this.getTestId('picture')} styles={this.styles.imageStyles} picturesource={item.imgSrc} shape='circle'></WmPicture>\n <Text {...this.getTestPropsForAction('chip'+ index+'label')}style={[this.styles.chipLabel, isSelected ? this.styles.activeChipLabel : null]}>{item.displayexp || item.displayfield}</Text>\n {!this.isDefaultView() && !this.state.props.disabled ? <WmIcon id={this.getTestId('clearbtn')} iconclass={'wi wi-clear'} iconsize={16} styles={this.styles.clearIcon} onTap={() => this.removeItem(item, index)}></WmIcon> : null}\n </TouchableOpacity>\n )\n }\n\n updateDefaultQueryModel() {\n if (this.state.dataItems && this.state.dataItems.length && this.isDefaultQuery) {\n const selectedItems = filter(this.state.dataItems, (item) => item.selected);\n if (selectedItems.length) {\n this.updateState({\n chipsList: selectedItems\n } as WmChipsState);\n }\n this.isDefaultQuery = false;\n }\n }\n\n componentDidMount(): void {\n super.componentDidMount();\n this.updateDefaultQueryModel();\n }\n\n componentDidUpdate(prevProps: WmChipsProps, prevState: WmChipsState) {\n super.componentDidUpdate(prevProps, prevState);\n if (prevState.chipsList !== this.state.chipsList) {\n this.searchRef?.computePosition();\n }\n }\n\n renderWidget(props: WmChipsProps) {\n const chips = this.state.chipsList;\n return (<View style={this.styles.root}>\n\n <View style={this.styles.chipsWrapper}>\n {\n this.isDefaultView() ? this.state.dataItems.map((item: any, index: any) => this.renderChip(item, index)) : null\n }\n { props.searchable || !this.isDefaultView() ?\n <View style={[this.styles.searchContainer, {flexDirection: props.inputposition === 'first' ? 'column' : 'column-reverse'}]}>\n <WmSearch\n id={this.getTestId('search')}\n name=\"app-chip-search\"\n styles={this.styles.search}\n placeholder={this.state.saturate ? this.maxSizeReached : props.placeholder}\n listener={this.listener}\n dataset={props.dataset}\n searchkey={props.searchkey}\n minchars={props.minchars}\n autofocus={props.autofocus}\n disabled={props.disabled || props.readonly || this.state.saturate}\n readonly={props.readonly}\n displayexpression={props.displayexpression}\n getDisplayExpression={props.getDisplayExpression}\n displayimagesrc={props.displayimagesrc}\n displayfield={props.displayfield}\n datafield={props.datafield}\n onSubmit={this.addItem.bind(this)}\n onChange={() => {\n this.isDefaultQuery = false;\n this.props.listener?.onComponentChange && this.props.listener?.onComponentChange(this)\n }}\n showSearchIcon={false}\n showclear={false}\n type={props.minchars === 0 ? 'autocomplete' : 'search'}/>\n <View style={{ flexDirection: 'row', flexWrap: 'wrap'}}>\n {chips && chips.length ?\n chips.map((item: any, index: any) => this.renderChip(item, index))\n : null}\n </View>\n </View>\n : null }\n </View>\n </View>);\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AAE3D,SAASC,KAAK,EAAEC,SAAS,EAAEC,GAAG,EAAEC,WAAW,EAAEC,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,KAAK,QAAQ,QAAQ;AACxG,OAAOC,YAAY,MAAM,eAAe;AACxC,SAASC,aAAa,QAAuB,gBAAgB;AAC7D,OAAOC,QAAQ,MAAM,oEAAoE;AACzF,SACEC,oBAAoB,EACpBC,gBAAgB,QACX,8EAA8E;AACrF,OAAOC,MAAM,MAAM,gEAAgE;AACnF,OAAOC,SAAS,MAAM,sEAAsE;AAC5F,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,8CAA8C;AAE7G,OAAO,MAAMC,YAAY,SAASL,gBAAgB,CAAe;EAAAM,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,oBAC9C,EAAE;I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AAC,GAChE,IACE,CACJ,CAAC,GACJ,IACD,CACF,CAAC;EACT;AACF","ignoreList":[]}
|
1
|
+
{"version":3,"names":["React","View","TouchableOpacity","Text","clone","findIndex","get","isUndefined","pull","forEach","filter","find","isEqual","merge","WmChipsProps","DEFAULT_CLASS","WmSearch","BaseDatasetComponent","BaseDatasetState","WmIcon","WmPicture","AccessibilityWidgetType","getAccessibilityProps","WmChipsState","constructor","args","_defineProperty","WmChips","props","onComponentInit","c","searchRef","val","onPropertyChange","name","$new","$old","length","updateState","chipsList","reset","_this$searchRef","state","query","onDataItemsUpdate","isDefaultQuery","updateDefaultQueryModel","addItem","$event","widget","_this$props","_this$props2","newChipList","allowAdd","push","queryModel","isFormFieldWidget","isDuplicate","resetSearchModel","invokeEvent","invokeEventCallback","toBoolean","setDatavalue","computeDisplayValue","displayValue","dataItems","item","selected","map","displayexp","displayfield","selectChip","chipItem","maxsize","selectedItem","d","key","dataValue","datafield","updateDatavalue","updateMaxSize","prevDatavalue","createCustomDataModel","dataObject","isCustom","clearSearch","chipListLength","saturate","removeItem","index","allowRemove","isDefaultView","_this$state$dataItems","searchable","renderChip","isSelected","createElement","_extends","getTestPropsForAction","CHIPS","style","styles","chip","activeChip","onPress","disabled","readonly","id","getTestId","iconclass","iconsize","doneIcon","icon","color","activeChipLabel","imageStyles","picturesource","imgSrc","shape","chipLabel","clearIcon","onTap","selectedItems","componentDidMount","componentDidUpdate","prevProps","prevState","_this$searchRef2","computePosition","renderWidget","chips","root","chipsWrapper","searchContainer","flexDirection","inputposition","search","placeholder","maxSizeReached","listener","dataset","searchkey","minchars","autofocus","displayexpression","getDisplayExpression","displayimagesrc","onSubmit","bind","onChange","_this$props$listener","_this$props$listener2","onComponentChange","showSearchIcon","showclear","type","flexWrap"],"sources":["chips.component.tsx"],"sourcesContent":["import React from 'react';\nimport { View, TouchableOpacity, Text } from 'react-native';\nimport { LifecycleListener } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { clone, findIndex, get, isUndefined, pull, forEach, filter, find, isEqual, merge } from 'lodash';\nimport WmChipsProps from './chips.props';\nimport { DEFAULT_CLASS, WmChipsStyles } from './chips.styles';\nimport WmSearch from '@wavemaker/app-rn-runtime/components/basic/search/search.component';\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 WmPicture from '@wavemaker/app-rn-runtime/components/basic/picture/picture.component';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility'; \n\nexport class WmChipsState extends BaseDatasetState<WmChipsProps> {\n chipsList: any = [];\n saturate: any;\n}\n\nexport default class WmChips extends BaseDatasetComponent<WmChipsProps, WmChipsState, WmChipsStyles> {\n constructor(props: WmChipsProps) {\n super(props, DEFAULT_CLASS, new WmChipsProps(), new WmChipsState());\n }\n\n private searchRef: WmSearch = null as any;\n private maxSizeReached = 'Max size reached';\n private isDefaultQuery: boolean = true;\n private prevDatavalue: any;\n\n private listener: LifecycleListener = {\n onComponentInit: (c) => {\n if (c instanceof WmSearch) {\n this.searchRef = c;\n }\n }\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 (!$new || $new.length === 0) {\n this.updateState({\n chipsList : []\n } as WmChipsState);\n }\n }\n }\n\n reset() {\n if (this.searchRef?.state.props.query) {\n this.searchRef.reset();\n }\n }\n\n onDataItemsUpdate() {\n super.onDataItemsUpdate();\n this.isDefaultQuery = true;\n this.updateDefaultQueryModel();\n }\n\n addItem($event: any, widget: any) {\n let newChipList = clone(this.state.chipsList),\n allowAdd;\n newChipList.push(widget.queryModel);\n const isFormFieldWidget = get(this.props, 'formfield');\n if (this.isDuplicate(widget.queryModel)) {\n this.resetSearchModel();\n return;\n }\n\n // @ts-ignore\n allowAdd = isFormFieldWidget ? this.props?.invokeEvent('onBeforeadd', [null, this, widget.queryModel]) : this.invokeEventCallback('onBeforeadd', [null, this, widget.queryModel]);\n\n if (!isUndefined(allowAdd) && !this.toBoolean(allowAdd)) {\n return;\n }\n\n this.updateState({\n chipsList: newChipList\n } as WmChipsState);\n\n this.setDatavalue(newChipList);\n\n // @ts-ignore\n isFormFieldWidget ? this.props?.invokeEvent('onAdd', [null, this, widget.queryModel]) : this.invokeEventCallback('onAdd', [null, this, widget.queryModel]);\n this.resetSearchModel();\n }\n\n computeDisplayValue() {\n this.updateState({\n props: {\n displayValue: ((this.state.dataItems || [] as any)\n .filter((item: any) => item.selected)\n .map((item: any) => item.displayexp || item.displayfield)) || ''\n }\n } as WmChipsState);\n }\n\n selectChip(chipItem: any) {\n if (!chipItem.selected && this.state.props.maxsize > 0 && (this.state.chipsList.length === this.state.props.maxsize)) {\n return;\n }\n chipItem.selected = !chipItem.selected;\n const newChipList: any = [];\n const selectedItem = find(this.state.dataItems, d => isEqual(d.key, chipItem.key));\n selectedItem.selected = chipItem.selected;\n forEach(this.state.dataItems, (item) => {\n if (item.selected) {\n newChipList.push(item);\n }\n });\n this.updateState({\n chipsList: newChipList\n } as WmChipsState);\n\n this.setDatavalue(newChipList);\n }\n\n setDatavalue(newChipList: any) {\n const dataValue = newChipList.map((item: any) => item.datafield);\n this.updateDatavalue(dataValue);\n this.updateMaxSize(newChipList.length);\n if (!this.props.invokeEvent) {\n this.invokeEventCallback('onChange', [null, this, dataValue, this.prevDatavalue])\n }\n this.prevDatavalue = dataValue;\n }\n\n toBoolean = (val: any) => ((val && val !== 'false') ? true : false);\n\n // Prepare datavalue object from a string(junk) value when datafield is allFields.\n createCustomDataModel(val: string) {\n return {\n key: `${this.state.props.name}_item${this.state.chipsList.length}`,\n dataObject: val,\n displayfield: val,\n datafield: val,\n isCustom: true\n }\n }\n\n resetSearchModel() {\n (this as any).searchRef.isDefaultQuery = false;\n this.searchRef.clearSearch();\n }\n\n isDuplicate(item: any) {\n return findIndex(this.state.chipsList, {datafield: item.datafield}) > -1;\n }\n\n // Check if max size is reached\n private updateMaxSize(chipListLength: number) {\n const saturate = this.state.props.maxsize > 0 && (chipListLength || this.state.chipsList.length) === this.state.props.maxsize;\n this.updateState({\n saturate: saturate\n } as WmChipsState);\n }\n\n removeItem(item: any, index: any) {\n let newChipList = clone(this.state.chipsList);\n const isFormFieldWidget = get(this.props, 'formfield');\n newChipList = pull(newChipList, item);\n // prevent deletion if the before-remove event callback returns false\n // @ts-ignore\n const allowRemove = isFormFieldWidget ? this.props.invokeEvent('onBeforeremove',[null, this, item]) : this.invokeEventCallback('onBeforeremove',[null, this, item]);\n if (!isUndefined(allowRemove) && !this.toBoolean(allowRemove)) {\n return;\n }\n this.updateState({\n chipsList: newChipList\n } as WmChipsState);\n this.setDatavalue(newChipList);\n // @ts-ignore\n isFormFieldWidget ? this.props.invokeEvent('onRemove', [null, this, item]) : this.invokeEventCallback('onRemove', [null, this, item]);\n }\n\n private isDefaultView() {\n return !this.state.props.searchable && this.state.dataItems?.length <= 10;\n }\n\n renderChip(item: any, index: any) {\n const isSelected = this.isDefaultView() ? item.selected : true;\n return (\n <TouchableOpacity\n {...this.getTestPropsForAction('chip'+ index)}\n {...getAccessibilityProps(AccessibilityWidgetType.CHIPS, {...this.state.props, selected: isSelected})}\n style={[this.styles.chip, isSelected ? this.styles.activeChip : null]}\n key={'chipitem_'+ index}\n onPress={() => {\n if (this.state.props.disabled || this.state.props.readonly) {\n return;\n }\n if (this.isDefaultView()) {\n this.selectChip(item);\n }\n if (get(this.props, 'formfield')) {\n // @ts-ignore\n this.props.invokeEvent('onChipclick', [null, this, item]);\n // @ts-ignore\n this.props.invokeEvent('onChipselect', [null, this, item]);\n } else {\n this.invokeEventCallback('onChipclick', [null, this, item]);\n this.invokeEventCallback('onChipselect', [null, this, item]);\n }\n }}>\n {isSelected && this.isDefaultView() ? <WmIcon id={this.getTestId('checkicon')} iconclass={'wm-sl-l sl-check'} iconsize={16} styles={merge({}, this.styles.doneIcon, {icon: {color: isSelected ? this.styles.activeChipLabel.color : null}})}></WmIcon> : null}\n <WmPicture id={this.getTestId('chip'+ index + 'picture')} styles={this.styles.imageStyles} picturesource={item.imgSrc} shape='circle'></WmPicture>\n <Text {...this.getTestPropsForAction('chip'+ index+'label')}style={[this.styles.chipLabel, isSelected ? this.styles.activeChipLabel : null]}>{item.displayexp || item.displayfield}</Text>\n {!this.isDefaultView() && !this.state.props.disabled ? <WmIcon id={this.getTestId('clearbtn')} iconclass={'wi wi-clear'} iconsize={16} styles={this.styles.clearIcon} onTap={() => this.removeItem(item, index)}></WmIcon> : null}\n </TouchableOpacity>\n )\n }\n\n updateDefaultQueryModel() {\n if (this.state.dataItems && this.state.dataItems.length && this.isDefaultQuery) {\n const selectedItems = filter(this.state.dataItems, (item) => item.selected);\n if (selectedItems.length) {\n this.updateState({\n chipsList: selectedItems\n } as WmChipsState);\n }\n this.isDefaultQuery = false;\n }\n }\n\n componentDidMount(): void {\n super.componentDidMount();\n this.updateDefaultQueryModel();\n }\n\n componentDidUpdate(prevProps: WmChipsProps, prevState: WmChipsState) {\n super.componentDidUpdate(prevProps, prevState);\n if (prevState.chipsList !== this.state.chipsList) {\n this.searchRef?.computePosition();\n }\n }\n\n renderWidget(props: WmChipsProps) {\n const chips = this.state.chipsList;\n return (<View style={this.styles.root}>\n\n <View style={this.styles.chipsWrapper}>\n {\n this.isDefaultView() ? this.state.dataItems.map((item: any, index: any) => this.renderChip(item, index)) : null\n }\n { props.searchable || !this.isDefaultView() ?\n <View style={[this.styles.searchContainer, {flexDirection: props.inputposition === 'first' ? 'column' : 'column-reverse'}]}>\n <WmSearch\n id={this.getTestId('search')}\n name=\"app-chip-search\"\n styles={this.styles.search}\n placeholder={this.state.saturate ? this.maxSizeReached : props.placeholder}\n listener={this.listener}\n dataset={props.dataset}\n searchkey={props.searchkey}\n minchars={props.minchars}\n autofocus={props.autofocus}\n disabled={props.disabled || props.readonly || this.state.saturate}\n readonly={props.readonly}\n displayexpression={props.displayexpression}\n getDisplayExpression={props.getDisplayExpression}\n displayimagesrc={props.displayimagesrc}\n displayfield={props.displayfield}\n datafield={props.datafield}\n onSubmit={this.addItem.bind(this)}\n onChange={() => {\n this.isDefaultQuery = false;\n this.props.listener?.onComponentChange && this.props.listener?.onComponentChange(this)\n }}\n showSearchIcon={false}\n showclear={false}\n type={props.minchars === 0 ? 'autocomplete' : 'search'}/>\n <View style={{ flexDirection: 'row', flexWrap: 'wrap'}}>\n {chips && chips.length ?\n chips.map((item: any, index: any) => this.renderChip(item, index))\n : null}\n </View>\n </View>\n : null }\n </View>\n </View>);\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AAE3D,SAASC,KAAK,EAAEC,SAAS,EAAEC,GAAG,EAAEC,WAAW,EAAEC,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,KAAK,QAAQ,QAAQ;AACxG,OAAOC,YAAY,MAAM,eAAe;AACxC,SAASC,aAAa,QAAuB,gBAAgB;AAC7D,OAAOC,QAAQ,MAAM,oEAAoE;AACzF,SACEC,oBAAoB,EACpBC,gBAAgB,QACX,8EAA8E;AACrF,OAAOC,MAAM,MAAM,gEAAgE;AACnF,OAAOC,SAAS,MAAM,sEAAsE;AAC5F,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,8CAA8C;AAE7G,OAAO,MAAMC,YAAY,SAASL,gBAAgB,CAAe;EAAAM,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,oBAC9C,EAAE;IAAAA,eAAA;EAAA;AAErB;AAEA,eAAe,MAAMC,OAAO,SAASV,oBAAoB,CAA4C;EACnGO,WAAWA,CAACI,KAAmB,EAAE;IAC/B,KAAK,CAACA,KAAK,EAAEb,aAAa,EAAE,IAAID,YAAY,CAAC,CAAC,EAAE,IAAIS,YAAY,CAAC,CAAC,CAAC;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,6 +11,7 @@ import { DEFAULT_CLASS } from './currency.styles';
|
|
11
11
|
import { BaseNumberComponent, BaseNumberState } from '@wavemaker/app-rn-runtime/components/input/basenumber/basenumber.component';
|
12
12
|
import { isNull } from "lodash";
|
13
13
|
import { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility';
|
14
|
+
import { countDecimalDigits, validateInputOnDevice } from '@wavemaker/app-rn-runtime/core/utils';
|
14
15
|
export class WmCurrencyState extends BaseNumberState {
|
15
16
|
constructor(...args) {
|
16
17
|
super(...args);
|
@@ -78,7 +79,21 @@ export default class WmCurrency extends BaseNumberComponent {
|
|
78
79
|
onFocus: this.onFocus.bind(this),
|
79
80
|
onKeyPress: this.validateInputEntry.bind(this),
|
80
81
|
onChangeText: text => {
|
81
|
-
|
82
|
+
const {
|
83
|
+
isValidText,
|
84
|
+
validText
|
85
|
+
} = validateInputOnDevice(text, "currency");
|
86
|
+
const decimalPlaces = props.decimalPlaces;
|
87
|
+
const decimalPlacesInNumber = countDecimalDigits(validText);
|
88
|
+
const restrictDecimalRegex = new RegExp(`(\\.\\d{${decimalPlaces}})\\d*`);
|
89
|
+
const updatedCurrencyText = validText.replace(restrictDecimalRegex, '$1');
|
90
|
+
if (!isValidText || decimalPlaces < decimalPlacesInNumber) {
|
91
|
+
var _this$widgetRef;
|
92
|
+
(_this$widgetRef = this.widgetRef) === null || _this$widgetRef === void 0 || _this$widgetRef.setNativeProps({
|
93
|
+
text: updatedCurrencyText
|
94
|
+
});
|
95
|
+
}
|
96
|
+
this.onChangeText.bind(this)(updatedCurrencyText, 'currency');
|
82
97
|
},
|
83
98
|
onChange: this.invokeChange.bind(this),
|
84
99
|
allowContentSelection: this.styles.text.userSelect === 'text'
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","View","Text","Platform","WmCurrencyProps","CURRENCY_INFO","WMTextInput","DEFAULT_CLASS","BaseNumberComponent","BaseNumberState","isNull","AccessibilityWidgetType","getAccessibilityProps","WmCurrencyState","constructor","args","_defineProperty","WmCurrency","props","onPropertyChange","name","$new","$old","updateState","currencySymbol","symbol","getStyleClassName","classes","state","floatinglabel","push","join","renderWidget","_this$state$textValue","opts","valueExpr","OS","textValue","toString","createElement","style","styles","root","labelWrapper","label","flex","_extends","getTestPropsForInput","CURRENCY","ref","widgetRef","selectionStart","selectionEnd","cursor","keyboardType","placeholderTextColor","placeholderText","color","input","text","isValid","invalid","floatingLabel","floatingLabelStyle","activeFloatingLabelStyle","activeFloatingLabel","editable","disabled","readonly","placeholder","onBlur","bind","onFocus","onKeyPress","validateInputEntry","onChangeText","onChange","invokeChange","allowContentSelection","userSelect"],"sources":["currency.component.tsx"],"sourcesContent":["import React from 'react';\nimport { View, Text, Platform } from 'react-native';\n\nimport WmCurrencyProps from './currency.props';\nimport { CURRENCY_INFO } from '@wavemaker/app-rn-runtime/core/currency-constants';\nimport { WMTextInput } from '@wavemaker/app-rn-runtime/core/components/textinput.component';\nimport { DEFAULT_CLASS, WmCurrencyStyles } from './currency.styles';\nimport {\n BaseNumberComponent,\n BaseNumberState\n} from '@wavemaker/app-rn-runtime/components/input/basenumber/basenumber.component';\nimport { isNull } from \"lodash\";\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility'; \nexport class WmCurrencyState extends BaseNumberState<WmCurrencyProps> {\n currencySymbol: any;\n}\n\nexport default class WmCurrency extends BaseNumberComponent<WmCurrencyProps, WmCurrencyState, WmCurrencyStyles> {\n\n constructor(props: WmCurrencyProps) {\n super(props, DEFAULT_CLASS, new WmCurrencyProps(), new WmCurrencyState());\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n super.onPropertyChange(name, $new, $old);\n switch (name) {\n case 'currency':\n if ($new) {\n this.updateState({\n currencySymbol: CURRENCY_INFO[$new].symbol,\n } as WmCurrencyState);\n }\n break;\n\n }\n }\n\n public getStyleClassName(): string | undefined {\n const classes = [];\n if (this.state.props.floatinglabel) {\n classes.push('app-currency-with-label'); \n }\n classes.push(super.getStyleClassName());\n return classes.join(' ');\n }\n\n renderWidget(props: WmCurrencyProps) {\n let opts: any = {};\n const valueExpr = Platform.OS === 'web' ? 'value' : 'defaultValue';\n opts[valueExpr] = this.state.textValue?.toString() || '';\n return (<View style={this.styles.root}>\n <View style={this.styles.labelWrapper}>\n <Text style={this.styles.label}>{this.state.currencySymbol}</Text>\n </View>\n <View style={{flex: 1}}>\n <WMTextInput\n {...this.getTestPropsForInput()}\n {...getAccessibilityProps(AccessibilityWidgetType.CURRENCY, props)}\n ref={(ref: any) => {\n 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 }}\n keyboardType=\"numeric\"\n placeholderTextColor={this.styles.placeholderText.color as any}\n style={[this.styles.input, this.styles.text, this.state.isValid ? {} : this.styles.invalid]}\n {...opts}\n floatingLabel={props.floatinglabel}\n floatingLabelStyle={this.styles.floatingLabel}\n activeFloatingLabelStyle={this.styles.activeFloatingLabel}\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)(
|
1
|
+
{"version":3,"names":["React","View","Text","Platform","WmCurrencyProps","CURRENCY_INFO","WMTextInput","DEFAULT_CLASS","BaseNumberComponent","BaseNumberState","isNull","AccessibilityWidgetType","getAccessibilityProps","countDecimalDigits","validateInputOnDevice","WmCurrencyState","constructor","args","_defineProperty","WmCurrency","props","onPropertyChange","name","$new","$old","updateState","currencySymbol","symbol","getStyleClassName","classes","state","floatinglabel","push","join","renderWidget","_this$state$textValue","opts","valueExpr","OS","textValue","toString","createElement","style","styles","root","labelWrapper","label","flex","_extends","getTestPropsForInput","CURRENCY","ref","widgetRef","selectionStart","selectionEnd","cursor","keyboardType","placeholderTextColor","placeholderText","color","input","text","isValid","invalid","floatingLabel","floatingLabelStyle","activeFloatingLabelStyle","activeFloatingLabel","editable","disabled","readonly","placeholder","onBlur","bind","onFocus","onKeyPress","validateInputEntry","onChangeText","isValidText","validText","decimalPlaces","decimalPlacesInNumber","restrictDecimalRegex","RegExp","updatedCurrencyText","replace","_this$widgetRef","setNativeProps","onChange","invokeChange","allowContentSelection","userSelect"],"sources":["currency.component.tsx"],"sourcesContent":["import React from 'react';\nimport { View, Text, Platform } from 'react-native';\n\nimport WmCurrencyProps from './currency.props';\nimport { CURRENCY_INFO } from '@wavemaker/app-rn-runtime/core/currency-constants';\nimport { WMTextInput } from '@wavemaker/app-rn-runtime/core/components/textinput.component';\nimport { DEFAULT_CLASS, WmCurrencyStyles } from './currency.styles';\nimport {\n BaseNumberComponent,\n BaseNumberState\n} from '@wavemaker/app-rn-runtime/components/input/basenumber/basenumber.component';\nimport { isNull } from \"lodash\";\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility'; \nimport { countDecimalDigits, validateInputOnDevice } from '@wavemaker/app-rn-runtime/core/utils';\nexport class WmCurrencyState extends BaseNumberState<WmCurrencyProps> {\n currencySymbol: any;\n}\n\nexport default class WmCurrency extends BaseNumberComponent<WmCurrencyProps, WmCurrencyState, WmCurrencyStyles> {\n\n constructor(props: WmCurrencyProps) {\n super(props, DEFAULT_CLASS, new WmCurrencyProps(), new WmCurrencyState());\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n super.onPropertyChange(name, $new, $old);\n switch (name) {\n case 'currency':\n if ($new) {\n this.updateState({\n currencySymbol: CURRENCY_INFO[$new].symbol,\n } as WmCurrencyState);\n }\n break;\n\n }\n }\n\n public getStyleClassName(): string | undefined {\n const classes = [];\n if (this.state.props.floatinglabel) {\n classes.push('app-currency-with-label'); \n }\n classes.push(super.getStyleClassName());\n return classes.join(' ');\n }\n\n renderWidget(props: WmCurrencyProps) {\n let opts: any = {};\n const valueExpr = Platform.OS === 'web' ? 'value' : 'defaultValue';\n opts[valueExpr] = this.state.textValue?.toString() || '';\n return (<View style={this.styles.root}>\n <View style={this.styles.labelWrapper}>\n <Text style={this.styles.label}>{this.state.currencySymbol}</Text>\n </View>\n <View style={{flex: 1}}>\n <WMTextInput\n {...this.getTestPropsForInput()}\n {...getAccessibilityProps(AccessibilityWidgetType.CURRENCY, props)}\n ref={(ref: any) => {\n 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 }}\n keyboardType=\"numeric\"\n placeholderTextColor={this.styles.placeholderText.color as any}\n style={[this.styles.input, this.styles.text, this.state.isValid ? {} : this.styles.invalid]}\n {...opts}\n floatingLabel={props.floatinglabel}\n floatingLabelStyle={this.styles.floatingLabel}\n activeFloatingLabelStyle={this.styles.activeFloatingLabel}\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 const {isValidText, validText} = validateInputOnDevice(text, \"currency\");\n const decimalPlaces = props.decimalPlaces;\n const decimalPlacesInNumber = countDecimalDigits(validText);\n const restrictDecimalRegex = new RegExp(`(\\\\.\\\\d{${decimalPlaces}})\\\\d*`);\n const updatedCurrencyText = validText.replace(restrictDecimalRegex, '$1');\n\n if (!isValidText || decimalPlaces < decimalPlacesInNumber) {\n (this.widgetRef as any)?.setNativeProps({ text: updatedCurrencyText });\n }\n\n this.onChangeText.bind(this)(updatedCurrencyText, 'currency');\n }}\n onChange={this.invokeChange.bind(this)}\n allowContentSelection={this.styles.text.userSelect === 'text'}\n />\n </View>\n </View>);\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,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