@wavemaker/app-rn-runtime 11.6.0-next.40753 → 11.6.0-next.41002
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- app-rn-runtime/components/advanced/carousel/carousel.component.js +10 -7
- app-rn-runtime/components/advanced/carousel/carousel.component.js.map +1 -1
- app-rn-runtime/components/advanced/carousel/carousel.styles.js +6 -3
- app-rn-runtime/components/advanced/carousel/carousel.styles.js.map +1 -1
- app-rn-runtime/components/advanced/webview/webview.component.js +27 -11
- app-rn-runtime/components/advanced/webview/webview.component.js.map +1 -1
- app-rn-runtime/components/advanced/webview/webview.props.js +0 -1
- app-rn-runtime/components/advanced/webview/webview.props.js.map +1 -1
- app-rn-runtime/components/basic/anchor/anchor.component.js +19 -6
- app-rn-runtime/components/basic/anchor/anchor.component.js.map +1 -1
- app-rn-runtime/components/basic/anchor/anchor.props.js +4 -0
- app-rn-runtime/components/basic/anchor/anchor.props.js.map +1 -1
- app-rn-runtime/components/basic/anchor/anchor.styles.js +1 -0
- app-rn-runtime/components/basic/anchor/anchor.styles.js.map +1 -1
- app-rn-runtime/components/basic/button/button.component.js +32 -6
- app-rn-runtime/components/basic/button/button.component.js.map +1 -1
- app-rn-runtime/components/basic/button/button.props.js +4 -0
- app-rn-runtime/components/basic/button/button.props.js.map +1 -1
- app-rn-runtime/components/basic/button/button.styles.js +6 -6
- app-rn-runtime/components/basic/button/button.styles.js.map +1 -1
- app-rn-runtime/components/basic/buttongroup/buttongroup.styles.js +13 -5
- app-rn-runtime/components/basic/buttongroup/buttongroup.styles.js.map +1 -1
- app-rn-runtime/components/basic/icon/icon.component.js +63 -12
- app-rn-runtime/components/basic/icon/icon.component.js.map +1 -1
- app-rn-runtime/components/basic/icon/icon.props.js +4 -0
- app-rn-runtime/components/basic/icon/icon.props.js.map +1 -1
- app-rn-runtime/components/basic/icon/icon.styles.js +2 -1
- app-rn-runtime/components/basic/icon/icon.styles.js.map +1 -1
- app-rn-runtime/components/basic/label/label.component.js +32 -25
- app-rn-runtime/components/basic/label/label.component.js.map +1 -1
- app-rn-runtime/components/basic/label/label.styles.js +4 -5
- app-rn-runtime/components/basic/label/label.styles.js.map +1 -1
- app-rn-runtime/components/basic/message/message.styles.js +3 -1
- app-rn-runtime/components/basic/message/message.styles.js.map +1 -1
- app-rn-runtime/components/basic/picture/picture.component.js +1 -0
- app-rn-runtime/components/basic/picture/picture.component.js.map +1 -1
- app-rn-runtime/components/basic/picture/picture.styles.js +2 -1
- app-rn-runtime/components/basic/picture/picture.styles.js.map +1 -1
- app-rn-runtime/components/basic/search/search.styles.js +6 -5
- app-rn-runtime/components/basic/search/search.styles.js.map +1 -1
- app-rn-runtime/components/chart/area-chart/area-chart.component.js +20 -15
- app-rn-runtime/components/chart/area-chart/area-chart.component.js.map +1 -1
- app-rn-runtime/components/chart/bar-chart/bar-chart.component.js +26 -15
- app-rn-runtime/components/chart/bar-chart/bar-chart.component.js.map +1 -1
- app-rn-runtime/components/chart/bar-chart/bar-chart.props.js +0 -2
- app-rn-runtime/components/chart/bar-chart/bar-chart.props.js.map +1 -1
- app-rn-runtime/components/chart/basechart.component.js +33 -7
- app-rn-runtime/components/chart/basechart.component.js.map +1 -1
- app-rn-runtime/components/chart/basechart.props.js +4 -2
- app-rn-runtime/components/chart/basechart.props.js.map +1 -1
- app-rn-runtime/components/chart/basechart.styles.js +9 -2
- app-rn-runtime/components/chart/basechart.styles.js.map +1 -1
- app-rn-runtime/components/chart/line-chart/line-chart.component.js +20 -17
- app-rn-runtime/components/chart/line-chart/line-chart.component.js.map +1 -1
- app-rn-runtime/components/chart/pie-chart/pie-chart.component.js +1 -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 +28 -7
- app-rn-runtime/components/chart/stack-chart/stack-chart.component.js.map +1 -1
- app-rn-runtime/components/chart/stack-chart/stack-chart.props.js +1 -0
- app-rn-runtime/components/chart/stack-chart/stack-chart.props.js.map +1 -1
- app-rn-runtime/components/chart/staticdata.js +215 -0
- app-rn-runtime/components/chart/staticdata.js.map +1 -0
- app-rn-runtime/components/container/container.component.js +11 -2
- app-rn-runtime/components/container/container.component.js.map +1 -1
- app-rn-runtime/components/container/container.props.js +1 -0
- app-rn-runtime/components/container/container.props.js.map +1 -1
- app-rn-runtime/components/container/panel/panel.component.js +6 -2
- app-rn-runtime/components/container/panel/panel.component.js.map +1 -1
- app-rn-runtime/components/container/panel/panel.props.js +4 -0
- app-rn-runtime/components/container/panel/panel.props.js.map +1 -1
- app-rn-runtime/components/container/tabs/tabheader/tabheader.styles.js +1 -1
- app-rn-runtime/components/container/tabs/tabheader/tabheader.styles.js.map +1 -1
- app-rn-runtime/components/container/wizard/wizard.component.js +14 -11
- app-rn-runtime/components/container/wizard/wizard.component.js.map +1 -1
- app-rn-runtime/components/container/wizard/wizard.styles.js +19 -3
- app-rn-runtime/components/container/wizard/wizard.styles.js.map +1 -1
- app-rn-runtime/components/container/wizard/wizardstep/wizardstep.component.js +27 -2
- app-rn-runtime/components/container/wizard/wizardstep/wizardstep.component.js.map +1 -1
- app-rn-runtime/components/container/wizard/wizardstep/wizardstep.props.js +3 -0
- app-rn-runtime/components/container/wizard/wizardstep/wizardstep.props.js.map +1 -1
- app-rn-runtime/components/data/card/card.component.js +7 -3
- app-rn-runtime/components/data/card/card.component.js.map +1 -1
- app-rn-runtime/components/data/card/card.props.js +4 -0
- app-rn-runtime/components/data/card/card.props.js.map +1 -1
- app-rn-runtime/components/data/form/form-action/form-action.styles.js +2 -1
- app-rn-runtime/components/data/form/form-action/form-action.styles.js.map +1 -1
- app-rn-runtime/components/data/list/list.component.js +58 -6
- app-rn-runtime/components/data/list/list.component.js.map +1 -1
- app-rn-runtime/components/device/barcodescanner/barcodescanner.styles.js +13 -6
- app-rn-runtime/components/device/barcodescanner/barcodescanner.styles.js.map +1 -1
- app-rn-runtime/components/device/camera/camera.styles.js +12 -4
- app-rn-runtime/components/device/camera/camera.styles.js.map +1 -1
- app-rn-runtime/components/dialogs/alertdialog/alertdialog.component.js +4 -0
- app-rn-runtime/components/dialogs/alertdialog/alertdialog.component.js.map +1 -1
- app-rn-runtime/components/dialogs/alertdialog/alertdialog.props.js +4 -0
- app-rn-runtime/components/dialogs/alertdialog/alertdialog.props.js.map +1 -1
- app-rn-runtime/components/dialogs/alertdialog/alertdialog.styles.js +2 -1
- app-rn-runtime/components/dialogs/alertdialog/alertdialog.styles.js.map +1 -1
- app-rn-runtime/components/dialogs/confirmdialog/confirmdialog.component.js +4 -0
- app-rn-runtime/components/dialogs/confirmdialog/confirmdialog.component.js.map +1 -1
- app-rn-runtime/components/dialogs/confirmdialog/confirmdialog.props.js +4 -0
- app-rn-runtime/components/dialogs/confirmdialog/confirmdialog.props.js.map +1 -1
- app-rn-runtime/components/dialogs/dialog/dialog.component.js +7 -3
- app-rn-runtime/components/dialogs/dialog/dialog.component.js.map +1 -1
- app-rn-runtime/components/dialogs/dialog/dialog.props.js +4 -0
- app-rn-runtime/components/dialogs/dialog/dialog.props.js.map +1 -1
- app-rn-runtime/components/dialogs/dialog/dialog.styles.js +11 -2
- app-rn-runtime/components/dialogs/dialog/dialog.styles.js.map +1 -1
- app-rn-runtime/components/input/basenumber/basenumber.component.js +12 -6
- app-rn-runtime/components/input/basenumber/basenumber.component.js.map +1 -1
- app-rn-runtime/components/input/checkbox/checkbox.component.js +5 -5
- app-rn-runtime/components/input/checkbox/checkbox.component.js.map +1 -1
- app-rn-runtime/components/input/checkbox/checkbox.styles.js +35 -5
- app-rn-runtime/components/input/checkbox/checkbox.styles.js.map +1 -1
- app-rn-runtime/components/input/checkboxset/checkboxset.component.js +6 -6
- app-rn-runtime/components/input/checkboxset/checkboxset.component.js.map +1 -1
- app-rn-runtime/components/input/checkboxset/checkboxset.styles.js +39 -10
- app-rn-runtime/components/input/checkboxset/checkboxset.styles.js.map +1 -1
- app-rn-runtime/components/input/composite/composite.component.js +1 -1
- app-rn-runtime/components/input/composite/composite.component.js.map +1 -1
- app-rn-runtime/components/input/composite/composite.props.js +1 -1
- app-rn-runtime/components/input/composite/composite.props.js.map +1 -1
- app-rn-runtime/components/input/currency/currency.component.js +17 -2
- app-rn-runtime/components/input/currency/currency.component.js.map +1 -1
- app-rn-runtime/components/input/currency/currency.props.js +1 -0
- app-rn-runtime/components/input/currency/currency.props.js.map +1 -1
- app-rn-runtime/components/input/currency/currency.styles.js +19 -1
- app-rn-runtime/components/input/currency/currency.styles.js.map +1 -1
- app-rn-runtime/components/input/epoch/base-datetime.component.js +70 -8
- app-rn-runtime/components/input/epoch/base-datetime.component.js.map +1 -1
- app-rn-runtime/components/input/epoch/date/date.component.js +8 -0
- app-rn-runtime/components/input/epoch/date/date.component.js.map +1 -1
- app-rn-runtime/components/input/epoch/date/date.styles.js +16 -0
- app-rn-runtime/components/input/epoch/date/date.styles.js.map +1 -1
- app-rn-runtime/components/input/epoch/datetime/datetime.component.js +8 -0
- app-rn-runtime/components/input/epoch/datetime/datetime.component.js.map +1 -1
- app-rn-runtime/components/input/epoch/datetime/datetime.props.js +1 -0
- app-rn-runtime/components/input/epoch/datetime/datetime.props.js.map +1 -1
- app-rn-runtime/components/input/epoch/datetime/datetime.styles.js +49 -1
- app-rn-runtime/components/input/epoch/datetime/datetime.styles.js.map +1 -1
- app-rn-runtime/components/input/epoch/time/time.component.js +8 -0
- app-rn-runtime/components/input/epoch/time/time.component.js.map +1 -1
- app-rn-runtime/components/input/epoch/time/time.styles.js +16 -0
- app-rn-runtime/components/input/epoch/time/time.styles.js.map +1 -1
- app-rn-runtime/components/input/fileupload/fileupload.styles.js +1 -1
- app-rn-runtime/components/input/fileupload/fileupload.styles.js.map +1 -1
- app-rn-runtime/components/input/number/number.component.js +11 -0
- app-rn-runtime/components/input/number/number.component.js.map +1 -1
- app-rn-runtime/components/input/number/number.props.js +1 -0
- app-rn-runtime/components/input/number/number.props.js.map +1 -1
- app-rn-runtime/components/input/number/number.styles.js +17 -0
- app-rn-runtime/components/input/number/number.styles.js.map +1 -1
- app-rn-runtime/components/input/select/select.styles.js +5 -1
- app-rn-runtime/components/input/select/select.styles.js.map +1 -1
- app-rn-runtime/components/input/slider/slider.styles.js +3 -3
- app-rn-runtime/components/input/slider/slider.styles.js.map +1 -1
- app-rn-runtime/components/input/switch/switch.component.js +3 -0
- app-rn-runtime/components/input/switch/switch.component.js.map +1 -1
- app-rn-runtime/components/input/switch/switch.styles.js +10 -5
- app-rn-runtime/components/input/switch/switch.styles.js.map +1 -1
- app-rn-runtime/components/input/text/text.component.js +11 -0
- app-rn-runtime/components/input/text/text.component.js.map +1 -1
- app-rn-runtime/components/input/text/text.props.js +1 -0
- app-rn-runtime/components/input/text/text.props.js.map +1 -1
- app-rn-runtime/components/input/text/text.styles.js +17 -0
- app-rn-runtime/components/input/text/text.styles.js.map +1 -1
- app-rn-runtime/components/input/textarea/textarea.component.js +11 -0
- app-rn-runtime/components/input/textarea/textarea.component.js.map +1 -1
- app-rn-runtime/components/input/textarea/textarea.props.js +1 -0
- app-rn-runtime/components/input/textarea/textarea.props.js.map +1 -1
- app-rn-runtime/components/input/textarea/textarea.styles.js +17 -0
- app-rn-runtime/components/input/textarea/textarea.styles.js.map +1 -1
- app-rn-runtime/components/input/toggle/toggle.component.js +43 -5
- app-rn-runtime/components/input/toggle/toggle.component.js.map +1 -1
- app-rn-runtime/components/input/toggle/toggle.styles.js +5 -12
- app-rn-runtime/components/input/toggle/toggle.styles.js.map +1 -1
- app-rn-runtime/components/navigation/appnavbar/appnavbar.component.js +6 -1
- app-rn-runtime/components/navigation/appnavbar/appnavbar.component.js.map +1 -1
- app-rn-runtime/components/navigation/appnavbar/appnavbar.props.js +1 -0
- app-rn-runtime/components/navigation/appnavbar/appnavbar.props.js.map +1 -1
- app-rn-runtime/components/navigation/appnavbar/appnavbar.styles.js +9 -1
- app-rn-runtime/components/navigation/appnavbar/appnavbar.styles.js.map +1 -1
- app-rn-runtime/components/navigation/basenav/basenav.component.js +1 -2
- app-rn-runtime/components/navigation/basenav/basenav.component.js.map +1 -1
- app-rn-runtime/components/navigation/menu/menu.styles.js +8 -5
- app-rn-runtime/components/navigation/menu/menu.styles.js.map +1 -1
- app-rn-runtime/components/navigation/popover/popover.component.js +4 -0
- app-rn-runtime/components/navigation/popover/popover.component.js.map +1 -1
- app-rn-runtime/components/navigation/popover/popover.props.js +4 -0
- app-rn-runtime/components/navigation/popover/popover.props.js.map +1 -1
- app-rn-runtime/components/navigation/popover/popover.styles.js +8 -2
- app-rn-runtime/components/navigation/popover/popover.styles.js.map +1 -1
- app-rn-runtime/components/page/tabbar/curve.js +84 -0
- app-rn-runtime/components/page/tabbar/curve.js.map +1 -0
- app-rn-runtime/components/page/tabbar/tabbar.component.js +42 -8
- app-rn-runtime/components/page/tabbar/tabbar.component.js.map +1 -1
- app-rn-runtime/components/page/tabbar/tabbar.styles.js +82 -16
- app-rn-runtime/components/page/tabbar/tabbar.styles.js.map +1 -1
- app-rn-runtime/core/base.component.js +5 -1
- app-rn-runtime/core/base.component.js.map +1 -1
- app-rn-runtime/core/components/floatinglabel.component.js +45 -0
- app-rn-runtime/core/components/floatinglabel.component.js.map +1 -0
- app-rn-runtime/core/components/textinput.component.js +25 -2
- app-rn-runtime/core/components/textinput.component.js.map +1 -1
- app-rn-runtime/core/tappable.component.js +36 -9
- app-rn-runtime/core/tappable.component.js.map +1 -1
- app-rn-runtime/package.json +5 -3
- app-rn-runtime/runtime/services/webprocess.service.js +0 -1
- app-rn-runtime/runtime/services/webprocess.service.js.map +1 -1
- app-rn-runtime/styles/theme.js +36 -0
- app-rn-runtime/styles/theme.js.map +1 -1
- app-rn-runtime/styles/theme.variables.js +26 -3
- app-rn-runtime/styles/theme.variables.js.map +1 -1
- app-rn-runtime/variables/model-variable.js +2 -1
- app-rn-runtime/variables/model-variable.js.map +1 -1
- app-rn-runtime/variables/service-variable.js +1 -0
- app-rn-runtime/variables/service-variable.js.map +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
3
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
|
-
import { includes, intersection, isNaN, isFinite, toArray } from 'lodash';
|
|
4
|
+
import { includes, intersection, isNaN, isFinite, toArray, isNil } from 'lodash';
|
|
5
5
|
import { BaseComponent, BaseComponentState } from "@wavemaker/app-rn-runtime/core/base.component";
|
|
6
6
|
import { DEFAULT_CLASS } from "@wavemaker/app-rn-runtime/components/navigation/basenav/basenav.styles";
|
|
7
7
|
import { Platform } from 'react-native';
|
|
@@ -39,11 +39,12 @@ export class BaseNumberComponent extends BaseComponent {
|
|
|
39
39
|
this === null || this === void 0 || (_this$widgetRef = this.widgetRef) === null || _this$widgetRef === void 0 ? void 0 : _this$widgetRef.focus();
|
|
40
40
|
}
|
|
41
41
|
validateOnDevice(value, type) {
|
|
42
|
+
var _value$match;
|
|
42
43
|
const isCurrencyField = type === 'currency';
|
|
43
44
|
let isValidText = true;
|
|
44
45
|
|
|
45
|
-
// *
|
|
46
|
-
if (/[a-zA-Z]/.test(value)) {
|
|
46
|
+
// * no alphabets except E, may contain E only once
|
|
47
|
+
if (/[a-df-zA-DF-Z]/.test(value) || !/^[^eE]*[eE]?[^eE]*$/.test(value)) {
|
|
47
48
|
isValidText = false;
|
|
48
49
|
}
|
|
49
50
|
|
|
@@ -52,6 +53,11 @@ export class BaseNumberComponent extends BaseComponent {
|
|
|
52
53
|
isValidText = false;
|
|
53
54
|
}
|
|
54
55
|
|
|
56
|
+
// * number only: not more than one minus and doesn't end with minus (-)
|
|
57
|
+
if (!isCurrencyField && Number((_value$match = value.match(/-/g)) === null || _value$match === void 0 ? void 0 : _value$match.length) > 1 || /\w-/.test(value)) {
|
|
58
|
+
isValidText = false;
|
|
59
|
+
}
|
|
60
|
+
|
|
55
61
|
// * check for more than one decimal point
|
|
56
62
|
if (/^\d*\.\d*\..*$/.test(value)) {
|
|
57
63
|
isValidText = false;
|
|
@@ -157,7 +163,7 @@ export class BaseNumberComponent extends BaseComponent {
|
|
|
157
163
|
datavalue: model
|
|
158
164
|
}
|
|
159
165
|
}, () => {
|
|
160
|
-
!this.props.onFieldChange && value !== oldValue && this.invokeEventCallback('onChange', [event, this.proxy,
|
|
166
|
+
!this.props.onFieldChange && value !== oldValue && this.invokeEventCallback('onChange', [event, this.proxy, model, oldValue]);
|
|
161
167
|
if (source === 'blur') {
|
|
162
168
|
this.invokeEventCallback('onBlur', [event, this.proxy]);
|
|
163
169
|
}
|
|
@@ -234,13 +240,13 @@ export class BaseNumberComponent extends BaseComponent {
|
|
|
234
240
|
*/
|
|
235
241
|
getValueInRange(value) {
|
|
236
242
|
const props = this.state.props;
|
|
237
|
-
if (!isNaN(props.minvalue) && value < props.minvalue) {
|
|
243
|
+
if (!isNil(null) && !isNaN(props.minvalue) && value < props.minvalue) {
|
|
238
244
|
this.updateState({
|
|
239
245
|
errorType: 'minvalue'
|
|
240
246
|
});
|
|
241
247
|
return props.minvalue;
|
|
242
248
|
}
|
|
243
|
-
if (!isNaN(props.maxvalue) && value > props.maxvalue) {
|
|
249
|
+
if (!isNil(null) && !isNaN(props.maxvalue) && value > props.maxvalue) {
|
|
244
250
|
this.updateState({
|
|
245
251
|
errorType: 'maxvalue'
|
|
246
252
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["includes","intersection","isNaN","isFinite","toArray","BaseComponent","BaseComponentState","DEFAULT_CLASS","Platform","countDecimalDigits","validateField","BaseNumberState","constructor","arguments","_defineProperty","BaseNumberComponent","props","defaultClass","length","undefined","defaultProps","defaultState","DECIMAL","GROUP","onChange","event","state","updateon","updateDatavalue","target","value","focus","_this$widgetRef","widgetRef","validateOnDevice","type","isCurrencyField","isValidText","test","Number","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","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 } 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 // * check for alphabets\n if (/[a-zA-Z]/.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 // * 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);\n if (!validNumber) {\n this.invokeEventCallback('onError', [ event, this.proxy, value, oldValue ]);\n return;\n }\n\n this.updateState({\n props: {\n datavalue: model\n }\n } as S, () => {\n !this.props.onFieldChange && value !== oldValue && this.invokeEventCallback('onChange', [event, this.proxy, value, oldValue]);\n if (source === 'blur') {\n this.invokeEventCallback('onBlur', [event, this.proxy]);\n }\n });\n }\n\n onBlur(event: any) {\n let newVal = event.target.value || this.state.textValue;\n this.validate(newVal);\n if (newVal === '') {\n setTimeout(() => {\n this.props.triggerValidation && this.props.triggerValidation();\n })\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 (!isNaN(props.minvalue) && value < props.minvalue) {\n this.updateState({ errorType: 'minvalue'} as S);\n return props.minvalue;\n\n }\n if (!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,QAAQ,QAAQ;AAEzE,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;IAAA,SAAAC,SAAA;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,EAAmF;IAAA,IAA1EC,YAAoB,GAAAJ,SAAA,CA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AAW,EAAEH,IAAI,EAAEC,IAAI,EAAEC,SAAS,CAAC,CAAC;QAClJ,CAAC,MAAM;UACL,IAAI,CAAC7F,KAAK,CAACkE,aAAa,IAAI,IAAI,CAAClE,KAAK,CAACkE,aAAa,CAAC,WAAW,EAAEyB,IAAI,EAAEC,IAAI,EAAEC,SAAS,CAAC;QAC1F;IACJ;EACF;AACF"}
|
|
1
|
+
{"version":3,"names":["includes","intersection","isNaN","isFinite","toArray","isNil","BaseComponent","BaseComponentState","DEFAULT_CLASS","Platform","countDecimalDigits","validateField","BaseNumberState","constructor","arguments","_defineProperty","BaseNumberComponent","props","defaultClass","length","undefined","defaultProps","defaultState","DECIMAL","GROUP","onChange","event","state","updateon","updateDatavalue","target","value","focus","_this$widgetRef","widgetRef","validateOnDevice","type","_value$match","isCurrencyField","isValidText","test","Number","match","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","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);\n if (!validNumber) {\n this.invokeEventCallback('onError', [ event, this.proxy, value, oldValue ]);\n return;\n }\n\n this.updateState({\n props: {\n datavalue: model\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 === '') {\n setTimeout(() => {\n this.props.triggerValidation && this.props.triggerValidation();\n })\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(null) && !isNaN(props.minvalue) && value < props.minvalue) {\n this.updateState({ errorType: 'minvalue'} as S);\n return props.minvalue;\n }\n if (!isNil(null) && !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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@@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
|
|
|
4
4
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { Text, TouchableOpacity } from 'react-native';
|
|
7
|
-
import { Checkbox } from 'react-native-paper';
|
|
8
7
|
import { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';
|
|
9
8
|
import { unStringify, validateField } from '@wavemaker/app-rn-runtime/core/utils';
|
|
9
|
+
import WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';
|
|
10
10
|
import WmCheckboxProps from './checkbox.props';
|
|
11
11
|
import { DEFAULT_CLASS } from './checkbox.styles';
|
|
12
12
|
export class WmCheckboxState extends BaseComponentState {
|
|
@@ -83,12 +83,12 @@ export default class WmCheckbox extends BaseComponent {
|
|
|
83
83
|
return /*#__PURE__*/React.createElement(TouchableOpacity, _extends({}, this.getTestPropsForAction(), {
|
|
84
84
|
style: this.styles.root,
|
|
85
85
|
onPress: this.onPress.bind(this)
|
|
86
|
-
}), this._background, /*#__PURE__*/React.createElement(
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
}), this._background, /*#__PURE__*/React.createElement(WmIcon, {
|
|
87
|
+
iconclass: "wi wi-check",
|
|
88
|
+
styles: this.state.isChecked ? this.styles.checkicon : this.styles.uncheckicon,
|
|
89
89
|
disabled: props.readonly || props.disabled
|
|
90
90
|
}), /*#__PURE__*/React.createElement(Text, _extends({}, this.getTestPropsForLabel(), {
|
|
91
|
-
style: this.styles.
|
|
91
|
+
style: this.styles.text
|
|
92
92
|
}), props.caption));
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Text","TouchableOpacity","
|
|
1
|
+
{"version":3,"names":["React","Text","TouchableOpacity","BaseComponent","BaseComponentState","unStringify","validateField","WmIcon","WmCheckboxProps","DEFAULT_CLASS","WmCheckboxState","constructor","arguments","_defineProperty","WmCheckbox","props","setChecked","dataValue","checkedvalue","value","updateState","isChecked","onPropertyChange","name","$new","$old","state","datavalue","updateDatavalue","validate","validationObj","isValid","errorType","onPress","readonly","invokeEventCallback","proxy","disabled","oldValue","uncheckedvalue","onFieldChange","renderWidget","createElement","_extends","getTestPropsForAction","style","styles","root","bind","_background","iconclass","checkicon","uncheckicon","getTestPropsForLabel","text","caption"],"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 {unStringify, validateField} from '@wavemaker/app-rn-runtime/core/utils';\nimport WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';\n\nimport WmCheckboxProps from './checkbox.props';\nimport { DEFAULT_CLASS, WmCheckboxStyles } from './checkbox.styles';\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.readonly) {\n this.invokeEventCallback('onFocus', [null, this.proxy]);\n }\n this.invokeEventCallback('onTap', [null, this.proxy]);\n if (this.state.props.disabled) {\n return;\n }\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)}>\n {this._background}\n <WmIcon iconclass=\"wi wi-check\" styles={this.state.isChecked ? this.styles.checkicon : this.styles.uncheckicon} disabled={props.readonly || props.disabled}/>\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,SAAQC,WAAW,EAAEC,aAAa,QAAO,sCAAsC;AAC/E,OAAOC,MAAM,MAAM,gEAAgE;AAEnF,OAAOC,eAAe,MAAM,kBAAkB;AAC9C,SAASC,aAAa,QAA0B,mBAAmB;AAEnE,OAAO,MAAMC,eAAe,SAASN,kBAAkB,CAAkB;EAAAO,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA,oBAClD,KAAK;IAAAA,eAAA,k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AAYA,CAAC1B,KAAsB,EAAE;IACnC,oBACEf,KAAA,CAAA0C,aAAA,CAACxC,gBAAgB,EAAAyC,QAAA,KAAK,IAAI,CAACC,qBAAqB,CAAC,CAAC;MAAEC,KAAK,EAAE,IAAI,CAACC,MAAM,CAACC,IAAK;MAACd,OAAO,EAAE,IAAI,CAACA,OAAO,CAACe,IAAI,CAAC,IAAI;IAAE,IACzG,IAAI,CAACC,WAAW,eACjBjD,KAAA,CAAA0C,aAAA,CAACnC,MAAM;MAAC2C,SAAS,EAAC,aAAa;MAACJ,MAAM,EAAE,IAAI,CAACpB,KAAK,CAACL,SAAS,GAAG,IAAI,CAACyB,MAAM,CAACK,SAAS,GAAG,IAAI,CAACL,MAAM,CAACM,WAAY;MAACf,QAAQ,EAAEtB,KAAK,CAACmB,QAAQ,IAAInB,KAAK,CAACsB;IAAS,CAAC,CAAC,eAC7JrC,KAAA,CAAA0C,aAAA,CAACzC,IAAI,EAAA0C,QAAA,KAAK,IAAI,CAACU,oBAAoB,CAAC,CAAC;MAAER,KAAK,EAAE,IAAI,CAACC,MAAM,CAACQ;IAAK,IAAEvC,KAAK,CAACwC,OAAc,CACvE,CAAC;EAEvB;AACF"}
|
|
@@ -8,26 +8,56 @@ BASE_THEME.registerStyle((themeVariables, addStyle) => {
|
|
|
8
8
|
alignContent: 'center'
|
|
9
9
|
},
|
|
10
10
|
text: {
|
|
11
|
-
color: themeVariables.checkedColor
|
|
12
|
-
},
|
|
13
|
-
checkboxLabel: {
|
|
14
11
|
alignSelf: 'center',
|
|
15
12
|
fontFamily: themeVariables.baseFont,
|
|
16
13
|
fontSize: 16,
|
|
17
|
-
color: themeVariables.labelDefaultColor
|
|
14
|
+
color: themeVariables.labelDefaultColor,
|
|
15
|
+
marginLeft: 8
|
|
18
16
|
},
|
|
19
17
|
skeleton: {
|
|
20
18
|
root: {
|
|
21
19
|
width: '100%',
|
|
22
20
|
height: 16
|
|
23
21
|
}
|
|
22
|
+
},
|
|
23
|
+
checkicon: {
|
|
24
|
+
root: {
|
|
25
|
+
width: 20,
|
|
26
|
+
height: 20,
|
|
27
|
+
borderRadius: 4,
|
|
28
|
+
backgroundColor: themeVariables.primaryColor,
|
|
29
|
+
justifyContent: 'center',
|
|
30
|
+
alignItems: 'center',
|
|
31
|
+
borderColor: themeVariables.checkedBorderColor
|
|
32
|
+
},
|
|
33
|
+
text: {
|
|
34
|
+
fontSize: 18
|
|
35
|
+
},
|
|
36
|
+
icon: {
|
|
37
|
+
color: themeVariables.checkedIconColor,
|
|
38
|
+
padding: 0
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
uncheckicon: {
|
|
42
|
+
root: {
|
|
43
|
+
width: 20,
|
|
44
|
+
height: 20,
|
|
45
|
+
borderWidth: 2,
|
|
46
|
+
borderRadius: 4,
|
|
47
|
+
borderColor: themeVariables.uncheckedBorderColor,
|
|
48
|
+
backgroundColor: themeVariables.uncheckedBgColor
|
|
49
|
+
},
|
|
50
|
+
text: {},
|
|
51
|
+
icon: {
|
|
52
|
+
color: 'transparent'
|
|
53
|
+
}
|
|
24
54
|
}
|
|
25
55
|
});
|
|
26
56
|
addStyle(DEFAULT_CLASS + '-disabled', '', {
|
|
27
57
|
root: {
|
|
28
58
|
opacity: 0.8
|
|
29
59
|
},
|
|
30
|
-
|
|
60
|
+
text: {
|
|
31
61
|
color: themeVariables.checkedDisabledColor
|
|
32
62
|
}
|
|
33
63
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BASE_THEME","defineStyles","DEFAULT_CLASS","registerStyle","themeVariables","addStyle","defaultStyles","root","flexDirection","alignContent","text","color","
|
|
1
|
+
{"version":3,"names":["BASE_THEME","defineStyles","DEFAULT_CLASS","registerStyle","themeVariables","addStyle","defaultStyles","root","flexDirection","alignContent","text","alignSelf","fontFamily","baseFont","fontSize","color","labelDefaultColor","marginLeft","skeleton","width","height","checkicon","borderRadius","backgroundColor","primaryColor","justifyContent","alignItems","borderColor","checkedBorderColor","icon","checkedIconColor","padding","uncheckicon","borderWidth","uncheckedBorderColor","uncheckedBgColor","opacity","checkedDisabledColor"],"sources":["checkbox.styles.ts"],"sourcesContent":["import BASE_THEME, { AllStyle } from '@wavemaker/app-rn-runtime/styles/theme';\nimport { BaseStyles, defineStyles } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { WmSkeletonStyles } from '../../basic/skeleton/skeleton.styles';\nimport { WmIconStyles } from '../../basic/icon/icon.styles';\n\nexport type WmCheckboxStyles = BaseStyles & {\n skeleton: WmSkeletonStyles;\n checkicon: WmIconStyles;\n uncheckicon: WmIconStyles;\n};\n\nexport const DEFAULT_CLASS = 'app-checkbox';\nBASE_THEME.registerStyle((themeVariables, addStyle) => {\n const defaultStyles: WmCheckboxStyles = defineStyles({\n root: {\n flexDirection: 'row',\n alignContent: 'center',\n },\n text: {\n alignSelf: 'center',\n fontFamily: themeVariables.baseFont,\n fontSize: 16,\n color: themeVariables.labelDefaultColor,\n marginLeft: 8\n },\n skeleton: {\n root: {\n width: '100%',\n height: 16\n }\n } as any as WmSkeletonStyles,\n checkicon : {\n root: {\n width: 20,\n height: 20,\n borderRadius: 4,\n backgroundColor: themeVariables.primaryColor,\n justifyContent: 'center',\n alignItems: 'center',\n borderColor: themeVariables.checkedBorderColor,\n },\n text: {\n fontSize: 18,\n },\n icon : {\n color: themeVariables.checkedIconColor,\n padding: 0\n }\n } as WmIconStyles,\n uncheckicon : {\n root: {\n width: 20,\n height: 20,\n borderWidth: 2,\n borderRadius: 4,\n borderColor: themeVariables.uncheckedBorderColor,\n backgroundColor: themeVariables.uncheckedBgColor,\n },\n text: {},\n icon : {\n color: 'transparent',\n }\n } as WmIconStyles,\n });\n\n\n addStyle(DEFAULT_CLASS + '-disabled', '', {\n root : {\n opacity: 0.8\n },\n text : {\n color: themeVariables.checkedDisabledColor\n }\n });\n\n addStyle(DEFAULT_CLASS, '', defaultStyles);\n });\n"],"mappings":"AAAA,OAAOA,UAAU,MAAoB,wCAAwC;AAC7E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,CAAC,CAAC;EAGJV,QAAQ,CAACH,aAAa,GAAG,WAAW,EAAE,EAAE,EAAE;IACxCK,IAAI,EAAG;MACL6B,OAAO,EAAE;IACX,CAAC;IACD1B,IAAI,EAAG;MACLK,KAAK,EAAEX,cAAc,CAACiC;IACxB;EACF,CAAC,CAAC;EAEFhC,QAAQ,CAACH,aAAa,EAAE,EAAE,EAAEI,aAAa,CAAC;AAC5C,CAAC,CAAC"}
|
|
@@ -5,10 +5,10 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { Text, View, TouchableOpacity } from 'react-native';
|
|
7
7
|
import { find, forEach, isEqual } from 'lodash';
|
|
8
|
-
import { Checkbox } from 'react-native-paper';
|
|
9
8
|
import WmCheckboxsetProps from './checkboxset.props';
|
|
10
9
|
import { DEFAULT_CLASS } from './checkboxset.styles';
|
|
11
10
|
import { BaseDatasetComponent, BaseDatasetState } from '@wavemaker/app-rn-runtime/components/input/basedataset/basedataset.component';
|
|
11
|
+
import WmIcon from '../../basic/icon/icon.component';
|
|
12
12
|
export class WmCheckboxsetState extends BaseDatasetState {
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
@@ -48,15 +48,15 @@ export default class WmCheckboxset extends BaseDatasetComponent {
|
|
|
48
48
|
const props = this.state.props;
|
|
49
49
|
const displayText = item.displayexp || item.displayfield;
|
|
50
50
|
return /*#__PURE__*/React.createElement(TouchableOpacity, _extends({}, this.getTestPropsForAction(index + ''), {
|
|
51
|
-
style:
|
|
51
|
+
style: this.styles.item,
|
|
52
52
|
onPress: this.onPress.bind(this, item),
|
|
53
53
|
key: item.key
|
|
54
|
-
}), /*#__PURE__*/React.createElement(
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
}), /*#__PURE__*/React.createElement(WmIcon, {
|
|
55
|
+
iconclass: "wi wi-check",
|
|
56
|
+
styles: item.selected ? this.styles.checkicon : this.styles.uncheckicon,
|
|
57
57
|
disabled: props.readonly || props.disabled
|
|
58
58
|
}), /*#__PURE__*/React.createElement(Text, _extends({}, this.getTestPropsForLabel(index + ''), {
|
|
59
|
-
style: this.styles.
|
|
59
|
+
style: this.styles.text
|
|
60
60
|
}), displayText));
|
|
61
61
|
}
|
|
62
62
|
computeDisplayValue() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Text","View","TouchableOpacity","find","forEach","isEqual","
|
|
1
|
+
{"version":3,"names":["React","Text","View","TouchableOpacity","find","forEach","isEqual","WmCheckboxsetProps","DEFAULT_CLASS","BaseDatasetComponent","BaseDatasetState","WmIcon","WmCheckboxsetState","constructor","arguments","_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","displayText","displayexp","displayfield","createElement","_extends","getTestPropsForAction","style","styles","bind","iconclass","checkicon","uncheckicon","getTestPropsForLabel","text","displayValue","filter","map","updateDatavalue","value","Promise","resolve","renderGroupby","groupedData","length","groupObj","groupHeaderTitle","renderCheckboxses","data","items","renderWidget","root","groupby"],"sources":["checkboxset.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, View, TouchableOpacity } from 'react-native';\nimport { find, forEach, isEqual } from 'lodash';\nimport { Checkbox } from 'react-native-paper';\n\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 WmSkeleton, { createSkeleton } from '../../basic/skeleton/skeleton.component';\nimport WmIcon from '../../basic/icon/icon.component';\n\nexport class WmCheckboxsetState extends BaseDatasetState<WmCheckboxsetProps> {\n isValid: boolean = true;\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) {\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}\n onPress={this.onPress.bind(this, item)} key={item.key}>\n <WmIcon iconclass=\"wi wi-check\" styles={item.selected? this.styles.checkicon : this.styles.uncheckicon} disabled={props.readonly || props.disabled}/>\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 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 return(<View>\n {items && items.length\n ? items.map((item: any, index: any) => this.renderChild(item, index))\n : null}\n </View>)\n }\n renderWidget(props: WmCheckboxsetProps) {\n const items = this.state.dataItems;\n return (\n <View style={this.styles.root}>\n {props.groupby && this.renderGroupby()}\n {!props.groupby && this.renderCheckboxses(items)}\n </View>\n );\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,gBAAgB,QAAQ,cAAc;AAC3D,SAASC,IAAI,EAAEC,OAAO,EAAEC,OAAO,QAAQ,QAAQ;AAG/C,OAAOC,kBAAkB,MAAM,qBAAqB;AACpD,SACEC,aAAa,QAGR,sBAAsB;AAC7B,SACEC,oBAAoB,EACpBC,gBAAgB,QACX,8EAA8E;AAErF,OAAOC,MAAM,MAAM,iCAAiC;AAEpD,OAAO,MAAMC,kBAAkB,SAASF,gBAAgB,CAAqB;EAAAG,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA,kBACxD,IAAI;EAAA;AACzB;AAEA,eAAe,MAAMC,aAAa,SAASP,oBAAoB,CAA8D;EAC3HI,WAAWA,CAACI,KAAyB,EAAE;IACrC,KAAK,CAACA,KAAK,EAAET,aAAa,EAAE,IAAID,kBAAkB,CAAC,CAAC,CAAC;EACvD;EAEAW,OAAOA,CAACC,IAAS,EAAE;IACjB,IAAI,CAACC,mBAAmB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,CAACC,KAAK,CAAC,CAAC;IACrD,IAAI,IAAI,CAACC,KAAK,CAACL,KAAK,CAACM,QAAQ,IAAI,IAAI,CAACD,KAAK,CAACL,KAAK,CAACO,QAAQ,EAAE;MAC1D;IACF;IACAL,IAAI,CAACM,QAAQ,GAAG,CAACN,IAAI,CAACM,QAAQ;IAC9B,MAAMC,aAAkB,GAAG,EAAE;IAC7B,MAAMC,YAAY,GAAGvB,IAAI,CAAC,IAAI,CAACkB,KAAK,C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AAA4C,aAAA,CAAC1C,IAAI;QAAC4B,GAAG,EAAEmC,QAAQ,CAACnC;MAAI,gBACtB9B,KAAA,CAAA4C,aAAA,CAAC3C,IAAI;QAAC8C,KAAK,EAAE,IAAI,CAACC,MAAM,CAACkB;MAAiB,GAAED,QAAQ,CAACnC,GAAU,CAAC,EAC/D,IAAI,CAACqC,iBAAiB,CAACF,QAAQ,CAACG,IAAI,CACjC,CAAC;IACX,CAAC,CAAC,GACA,IACA,CAAC;EAEX;EAEAD,iBAAiBA,CAACE,KAAU,EAAE;IAC5B,MAAMpD,KAAK,GAAG,IAAI,CAACK,KAAK,CAACL,KAAK;IAC9B,oBAAOjB,KAAA,CAAA4C,aAAA,CAAC1C,IAAI,QACTmE,KAAK,IAAIA,KAAK,CAACL,MAAM,GAClBK,KAAK,CAACZ,GAAG,CAAC,CAACtC,IAAS,EAAEqB,KAAU,KAAK,IAAI,CAACD,WAAW,CAACpB,IAAI,EAAEqB,KAAK,CAAC,CAAC,GACnE,IACA,CAAC;EACT;EACA8B,YAAYA,CAACrD,KAAyB,EAAE;IACtC,MAAMoD,KAAK,GAAG,IAAI,CAAC/C,KAAK,CAACM,SAAS;IAClC,oBACE5B,KAAA,CAAA4C,aAAA,CAAC1C,IAAI;MAAC6C,KAAK,EAAE,IAAI,CAACC,MAAM,CAACuB;IAAK,GAC3BtD,KAAK,CAACuD,OAAO,IAAI,IAAI,CAACV,aAAa,CAAC,CAAC,EACrC,CAAC7C,KAAK,CAACuD,OAAO,IAAI,IAAI,CAACL,iBAAiB,CAACE,KAAK,CAC3C,CAAC;EAEX;AACF"}
|
|
@@ -5,7 +5,11 @@ BASE_THEME.registerStyle((themeVariables, addStyle) => {
|
|
|
5
5
|
const defaultStyles = defineStyles({
|
|
6
6
|
root: {},
|
|
7
7
|
text: {
|
|
8
|
-
|
|
8
|
+
alignSelf: 'center',
|
|
9
|
+
fontFamily: themeVariables.baseFont,
|
|
10
|
+
fontSize: 16,
|
|
11
|
+
color: themeVariables.labelDefaultColor,
|
|
12
|
+
marginLeft: 8
|
|
9
13
|
},
|
|
10
14
|
groupHeaderTitle: {
|
|
11
15
|
backgroundColor: themeVariables.groupHeadingBgColor,
|
|
@@ -17,27 +21,52 @@ BASE_THEME.registerStyle((themeVariables, addStyle) => {
|
|
|
17
21
|
},
|
|
18
22
|
item: {
|
|
19
23
|
flexDirection: 'row',
|
|
20
|
-
alignContent: 'center'
|
|
21
|
-
|
|
22
|
-
checkedItem: {},
|
|
23
|
-
checkboxLabel: {
|
|
24
|
-
alignSelf: 'center',
|
|
25
|
-
fontFamily: themeVariables.baseFont,
|
|
26
|
-
fontSize: 16,
|
|
27
|
-
color: themeVariables.labelDefaultColor
|
|
24
|
+
alignContent: 'center',
|
|
25
|
+
marginTop: 8
|
|
28
26
|
},
|
|
29
27
|
skeleton: {
|
|
30
28
|
root: {
|
|
31
29
|
width: '100%',
|
|
32
30
|
height: 16
|
|
33
31
|
}
|
|
32
|
+
},
|
|
33
|
+
checkicon: {
|
|
34
|
+
root: {
|
|
35
|
+
width: 20,
|
|
36
|
+
height: 20,
|
|
37
|
+
borderRadius: 4,
|
|
38
|
+
backgroundColor: themeVariables.primaryColor,
|
|
39
|
+
justifyContent: 'center',
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
borderColor: themeVariables.checkedBorderColor
|
|
42
|
+
},
|
|
43
|
+
text: {
|
|
44
|
+
fontSize: 18
|
|
45
|
+
},
|
|
46
|
+
icon: {
|
|
47
|
+
color: themeVariables.checkedIconColor,
|
|
48
|
+
padding: 0
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
uncheckicon: {
|
|
52
|
+
root: {
|
|
53
|
+
width: 20,
|
|
54
|
+
height: 20,
|
|
55
|
+
borderWidth: 2,
|
|
56
|
+
borderRadius: 4,
|
|
57
|
+
borderColor: themeVariables.uncheckedBorderColor
|
|
58
|
+
},
|
|
59
|
+
text: {},
|
|
60
|
+
icon: {
|
|
61
|
+
color: 'transparent'
|
|
62
|
+
}
|
|
34
63
|
}
|
|
35
64
|
});
|
|
36
65
|
addStyle(DEFAULT_CLASS + '-disabled', '', {
|
|
37
66
|
root: {
|
|
38
67
|
opacity: 0.8
|
|
39
68
|
},
|
|
40
|
-
|
|
69
|
+
text: {
|
|
41
70
|
color: themeVariables.checkedDisabledColor
|
|
42
71
|
}
|
|
43
72
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BASE_THEME","defineStyles","DEFAULT_CLASS","registerStyle","themeVariables","addStyle","defaultStyles","root","text","color","
|
|
1
|
+
{"version":3,"names":["BASE_THEME","defineStyles","DEFAULT_CLASS","registerStyle","themeVariables","addStyle","defaultStyles","root","text","alignSelf","fontFamily","baseFont","fontSize","color","labelDefaultColor","marginLeft","groupHeaderTitle","backgroundColor","groupHeadingBgColor","paddingLeft","paddingRight","lineHeight","item","flexDirection","alignContent","marginTop","skeleton","width","height","checkicon","borderRadius","primaryColor","justifyContent","alignItems","borderColor","checkedBorderColor","icon","checkedIconColor","padding","uncheckicon","borderWidth","uncheckedBorderColor","opacity","checkedDisabledColor"],"sources":["checkboxset.styles.ts"],"sourcesContent":["import BASE_THEME, { AllStyle } from '@wavemaker/app-rn-runtime/styles/theme';\nimport { BaseStyles, defineStyles } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { WmSkeletonStyles } from '../../basic/skeleton/skeleton.styles';\nimport { WmIconStyles } from '../../basic/icon/icon.styles';\n\nexport type WmCheckboxsetStyles = BaseStyles & {\n groupHeaderTitle: AllStyle;\n item: AllStyle;\n skeleton: WmSkeletonStyles;\n checkicon: WmIconStyles;\n uncheckicon: WmIconStyles;\n};\n\nexport const DEFAULT_CLASS = 'app-checkboxset';\nBASE_THEME.registerStyle((themeVariables, addStyle) => {\n const defaultStyles: WmCheckboxsetStyles = defineStyles({\n root: {},\n text: {\n alignSelf: 'center',\n fontFamily: themeVariables.baseFont,\n fontSize: 16,\n color: themeVariables.labelDefaultColor,\n marginLeft: 8,\n },\n groupHeaderTitle: {\n backgroundColor: themeVariables.groupHeadingBgColor,\n fontSize: 16,\n paddingLeft: 8,\n paddingRight: 8,\n lineHeight: 40,\n fontFamily: themeVariables.baseFont\n } as AllStyle,\n item: {\n flexDirection: 'row',\n alignContent: 'center',\n marginTop: 8\n } as AllStyle,\n skeleton: {\n root: {\n width: '100%',\n height: 16\n }\n } as any as WmSkeletonStyles,\n checkicon : {\n root: {\n width: 20,\n height: 20,\n borderRadius: 4,\n backgroundColor: themeVariables.primaryColor,\n justifyContent: 'center',\n alignItems: 'center',\n borderColor: themeVariables.checkedBorderColor,\n },\n text: {\n fontSize: 18,\n },\n icon : {\n color: themeVariables.checkedIconColor,\n padding: 0\n }\n } as WmIconStyles,\n uncheckicon : {\n root: {\n width: 20,\n height: 20,\n borderWidth: 2,\n borderRadius: 4,\n borderColor: themeVariables.uncheckedBorderColor,\n },\n text: {},\n icon : {\n color: 'transparent',\n }\n } as WmIconStyles,\n });\n\n addStyle(DEFAULT_CLASS + '-disabled', '', {\n root: {\n opacity: 0.8\n },\n text : {\n color: themeVariables.checkedDisabledColor\n }\n });\n\n addStyle(DEFAULT_CLASS, '', defaultStyles);\n});\n"],"mappings":"AAAA,OAAOA,UAAU,MAAoB,wCAAwC;AAC7E,SAAqBC,YAAY,QAAQ,+CAA+C;AAYxF,OAAO,MAAMC,aAAa,GAAG,iBAAiB;AAC9CF,UAAU,CAACG,aAAa,CAAC,CAACC,cAAc,EAAEC,QAAQ,KAAK;EACrD,MAAMC,aAAkC,GAAGL,YAAY,CAAC;IACpDM,IAAI,EAAE,CAAC,CAAC;IACRC,IAAI,EAAE;MACJC,SAAS,EAAE,QAAQ;MACnBC,UAAU,EAAEN,cAAc,CAACO,QAAQ;MACnCC,QAAQ,EAAE,EAAE;MACZC,KAAK,EAAET,cAAc,CAACU,iBAAiB;MACvCC,UAAU,EAAE;IACd,CAAC;IACHC,gBAAgB,EAAE;MAChBC,eAAe,EAAEb,cAAc,CAACc,mBAAmB;MACnDN,QA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,EAAEI,aAAa,CAAC;AAC5C,CAAC,CAAC"}
|
|
@@ -15,7 +15,7 @@ export default class WmComposite extends BaseComponent {
|
|
|
15
15
|
super(props, DEFAULT_CLASS, new WmCompositeProps());
|
|
16
16
|
}
|
|
17
17
|
renderWidget(props) {
|
|
18
|
-
const styles = this.theme.mergeStyle({}, this.styles, this.theme.getStyle(POSITION_STYLES[props.captionposition]));
|
|
18
|
+
const styles = this.theme.mergeStyle({}, this.styles, props.captionposition ? this.theme.getStyle(POSITION_STYLES[props.captionposition]) : {});
|
|
19
19
|
return /*#__PURE__*/React.createElement(View, {
|
|
20
20
|
style: styles.root
|
|
21
21
|
}, this._background, props.children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","BaseComponent","BaseComponentState","WmCompositeProps","DEFAULT_CLASS","WmCompositeState","POSITION_STYLES","WmComposite","constructor","props","renderWidget","styles","theme","mergeStyle","
|
|
1
|
+
{"version":3,"names":["React","View","BaseComponent","BaseComponentState","WmCompositeProps","DEFAULT_CLASS","WmCompositeState","POSITION_STYLES","WmComposite","constructor","props","renderWidget","styles","theme","mergeStyle","captionposition","getStyle","createElement","style","root","_background","children"],"sources":["composite.component.tsx"],"sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\n\nimport WmCompositeProps from './composite.props';\nimport { DEFAULT_CLASS, WmCompositeStyles } from './composite.styles';\n\nexport class WmCompositeState extends BaseComponentState<WmCompositeProps> {};\n\nconst POSITION_STYLES = {\n 'top': 'app-composite-top-caption',\n 'left': 'app-composite-left-caption',\n 'right': 'app-composite-right-caption'\n};\n\nexport default class WmComposite extends BaseComponent<WmCompositeProps, WmCompositeState, WmCompositeStyles> {\n\n constructor(props: WmCompositeProps) {\n super(props, DEFAULT_CLASS, new WmCompositeProps());\n }\n\n renderWidget(props: WmCompositeProps) {\n const styles = this.theme.mergeStyle({}, \n this.styles,\n props.captionposition ? this.theme.getStyle(POSITION_STYLES[props.captionposition]) : {}\n );\n return (<View style={styles.root}>{this._background}{props.children}</View>); \n }\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AAEjG,OAAOC,gBAAgB,MAAM,mBAAmB;AAChD,SAASC,aAAa,QAA2B,oBAAoB;AAErE,OAAO,MAAMC,gBAAgB,SAASH,kBAAkB,CAAmB;AAAE;AAE7E,MAAMI,eAAe,GAAG;EACtB,KAAK,EAAE,2BAA2B;EAClC,MAAM,EAAE,4BAA4B;EACpC,OAAO,EAAE;AACX,CAAC;AAED,eAAe,MAAMC,WAAW,SAASN,aAAa,CAAwD;EAE5GO,WAAWA,CAACC,KAAuB,EAAE;IACnC,KAAK,CAACA,KAAK,EAAEL,aAAa,EAAE,IAAID,gBAAgB,CAAC,CAAC,CAAC;EACrD;EAEAO,YAAYA,CAACD,KAAuB,EAAE;IACpC,MAAME,MAAM,GAAG,IAAI,CAACC,KAAK,CAACC,UAAU,CAAC,CAAC,CAAC,EACrC,IAAI,CAACF,MAAM,EACXF,KAAK,CAACK,eAAe,GAAG,IAAI,CAACF,KAAK,CAACG,QAAQ,CAACT,eAAe,CAACG,KAAK,CAACK,eAAe,CAAC,CAAC,GAAG,CAAC,CACzF,CAAC;IACD,oBAAQf,KAAA,CAAAiB,aAAA,CAAChB,IAAI;MAACiB,KAAK,EAAEN,MAAM,CAACO;IAAK,GAAE,IAAI,CAACC,WAAW,EAAEV,KAAK,CAACW,QAAe,CAAC;EAC7E;AACF"}
|
|
@@ -6,7 +6,7 @@ export default class WmCompositeProps extends BaseProps {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
8
8
|
_defineProperty(this, "children", void 0);
|
|
9
|
-
_defineProperty(this, "captionposition",
|
|
9
|
+
_defineProperty(this, "captionposition", undefined);
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=composite.props.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BaseProps","WmCompositeProps","constructor","arguments","_defineProperty"],"sources":["composite.props.ts"],"sourcesContent":["import { BaseProps } from '@wavemaker/app-rn-runtime/core/base.component';\n\nexport default class WmCompositeProps extends BaseProps {\n children: any;\n captionposition: 'left' | 'right' | 'top' =
|
|
1
|
+
{"version":3,"names":["BaseProps","WmCompositeProps","constructor","arguments","_defineProperty","undefined"],"sources":["composite.props.ts"],"sourcesContent":["import { BaseProps } from '@wavemaker/app-rn-runtime/core/base.component';\n\nexport default class WmCompositeProps extends BaseProps {\n children: any;\n captionposition: 'left' | 'right' | 'top' | undefined = undefined;\n}"],"mappings":";;;AAAA,SAASA,SAAS,QAAQ,+CAA+C;AAEzE,eAAe,MAAMC,gBAAgB,SAASD,SAAS,CAAC;EAAAE,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA;IAAAA,eAAA,0BAEIC,SAAS;EAAA;AACrE"}
|
|
@@ -32,6 +32,14 @@ export default class WmCurrency extends BaseNumberComponent {
|
|
|
32
32
|
break;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
getStyleClassName() {
|
|
36
|
+
const classes = [];
|
|
37
|
+
if (this.state.props.floatinglabel) {
|
|
38
|
+
classes.push('app-currency-with-label');
|
|
39
|
+
}
|
|
40
|
+
classes.push(super.getStyleClassName());
|
|
41
|
+
return classes.join(' ');
|
|
42
|
+
}
|
|
35
43
|
renderWidget(props) {
|
|
36
44
|
var _this$state$textValue;
|
|
37
45
|
let opts = {};
|
|
@@ -43,7 +51,11 @@ export default class WmCurrency extends BaseNumberComponent {
|
|
|
43
51
|
style: this.styles.labelWrapper
|
|
44
52
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
45
53
|
style: this.styles.label
|
|
46
|
-
}, this.state.currencySymbol)), /*#__PURE__*/React.createElement(
|
|
54
|
+
}, this.state.currencySymbol)), /*#__PURE__*/React.createElement(View, {
|
|
55
|
+
style: {
|
|
56
|
+
flex: 1
|
|
57
|
+
}
|
|
58
|
+
}, /*#__PURE__*/React.createElement(WMTextInput, _extends({}, this.getTestPropsForInput(), {
|
|
47
59
|
ref: ref => {
|
|
48
60
|
this.widgetRef = ref;
|
|
49
61
|
// @ts-ignore
|
|
@@ -56,6 +68,9 @@ export default class WmCurrency extends BaseNumberComponent {
|
|
|
56
68
|
placeholderTextColor: this.styles.placeholderText.color,
|
|
57
69
|
style: [this.styles.input, this.styles.text, this.state.isValid ? {} : this.styles.invalid]
|
|
58
70
|
}, opts, {
|
|
71
|
+
floatingLabel: props.floatinglabel,
|
|
72
|
+
floatingLabelStyle: this.styles.floatingLabel,
|
|
73
|
+
activeFloatingLabelStyle: this.styles.activeFloatingLabel,
|
|
59
74
|
editable: props.disabled || props.readonly ? false : true,
|
|
60
75
|
placeholder: props.placeholder,
|
|
61
76
|
value: this.state.textValue,
|
|
@@ -67,7 +82,7 @@ export default class WmCurrency extends BaseNumberComponent {
|
|
|
67
82
|
},
|
|
68
83
|
onChange: this.invokeChange.bind(this),
|
|
69
84
|
allowContentSelection: this.styles.text.userSelect === 'text'
|
|
70
|
-
})));
|
|
85
|
+
}))));
|
|
71
86
|
}
|
|
72
87
|
}
|
|
73
88
|
//# sourceMappingURL=currency.component.js.map
|