@wavemaker/app-rn-runtime 11.4.0-next.141076 → 11.4.0-next.141077
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/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 +17 -0
- app-rn-runtime/components/chart/basechart.styles.js.map +1 -1
- app-rn-runtime/components/chart/donut-chart/donut-chart.props.js +0 -1
- app-rn-runtime/components/chart/donut-chart/donut-chart.props.js.map +1 -1
- app-rn-runtime/components/chart/legend/legend.component.js +36 -0
- app-rn-runtime/components/chart/legend/legend.component.js.map +1 -0
- app-rn-runtime/components/chart/pie-chart/pie-chart.component.js +119 -40
- app-rn-runtime/components/chart/pie-chart/pie-chart.component.js.map +1 -1
- app-rn-runtime/components/chart/pie-chart/pie-chart.props.js +1 -2
- app-rn-runtime/components/chart/pie-chart/pie-chart.props.js.map +1 -1
- app-rn-runtime/components/data/form/form-action/form-action.component.js +1 -0
- app-rn-runtime/components/data/form/form-action/form-action.component.js.map +1 -1
- app-rn-runtime/components/data/form/form-action/form-action.props.js +3 -1
- app-rn-runtime/components/data/form/form-action/form-action.props.js.map +1 -1
- app-rn-runtime/components/data/form/form-field/form-field.component.js +21 -0
- app-rn-runtime/components/data/form/form-field/form-field.component.js.map +1 -1
- app-rn-runtime/components/data/form/form-field/form-field.props.js +8 -0
- app-rn-runtime/components/data/form/form-field/form-field.props.js.map +1 -1
- app-rn-runtime/components/data/form/form.component.js +92 -1
- app-rn-runtime/components/data/form/form.component.js.map +1 -1
- app-rn-runtime/components/data/form/form.props.js +2 -0
- app-rn-runtime/components/data/form/form.props.js.map +1 -1
- app-rn-runtime/components/data/form/form.styles.js +6 -0
- app-rn-runtime/components/data/form/form.styles.js.map +1 -1
- app-rn-runtime/components/data/liveform/liveform.component.js +102 -0
- app-rn-runtime/components/data/liveform/liveform.component.js.map +1 -0
- app-rn-runtime/components/input/baseinput/baseinput.component.js +2 -2
- app-rn-runtime/components/input/baseinput/baseinput.component.js.map +1 -1
- app-rn-runtime/core/formatters.js.map +1 -1
- app-rn-runtime/core/utils.js +19 -0
- app-rn-runtime/core/utils.js.map +1 -1
- app-rn-runtime/package.json +3 -3
- app-rn-runtime/runtime/base-fragment.component.js +13 -0
- app-rn-runtime/runtime/base-fragment.component.js.map +1 -1
- app-rn-runtime/styles/theme.variables.js +2 -0
- app-rn-runtime/styles/theme.variables.js.map +1 -1
- app-rn-runtime/variables/http.service.js +6 -2
- app-rn-runtime/variables/http.service.js.map +1 -1
- app-rn-runtime/variables/live-variable.js +115 -0
- app-rn-runtime/variables/live-variable.js.map +1 -0
- app-rn-runtime/variables/service-variable.js +6 -1
- app-rn-runtime/variables/service-variable.js.map +1 -1
|
@@ -7,6 +7,7 @@ export default class BaseChartComponentProps extends BaseProps {
|
|
|
7
7
|
super(...arguments);
|
|
8
8
|
_defineProperty(this, "xaxisdatakey", '');
|
|
9
9
|
_defineProperty(this, "yaxisdatakey", '');
|
|
10
|
+
_defineProperty(this, "iconclass", '');
|
|
10
11
|
_defineProperty(this, "dataset", void 0);
|
|
11
12
|
_defineProperty(this, "type", '');
|
|
12
13
|
_defineProperty(this, "title", '');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BaseProps","BaseChartComponentProps","constructor","arguments","_defineProperty"],"sources":["basechart.props.ts"],"sourcesContent":["import { BaseProps } from '@wavemaker/app-rn-runtime/core/base.component';\n\nexport default class BaseChartComponentProps extends BaseProps {\n xaxisdatakey: string = '';\n yaxisdatakey: string = '';\n dataset: any;\n type: string = '';\n title: string = '';\n subheading: string = '';\n theme: string = '';\n xaxislabel: string = '';\n xunits: string = '';\n staggerlabels: boolean = false;\n yaxislabel: string = '';\n yunits: string = '';\n yaxislabeldistance: number = 50;\n xaxislabeldistance: number = 30;\n customcolors: string | Array<string> = '';\n legendheight: number = 0;\n labellegendheight: number = 0;\n labeltype:
|
|
1
|
+
{"version":3,"names":["BaseProps","BaseChartComponentProps","constructor","arguments","_defineProperty"],"sources":["basechart.props.ts"],"sourcesContent":["import { BaseProps } from '@wavemaker/app-rn-runtime/core/base.component';\n\nexport default class BaseChartComponentProps extends BaseProps {\n xaxisdatakey: string = '';\n yaxisdatakey: string = '';\n iconclass = '';\n dataset: any;\n type: string = '';\n title: string = '';\n subheading: string = '';\n theme: string = '';\n xaxislabel: string = '';\n xunits: string = '';\n staggerlabels: boolean = false;\n yaxislabel: string = '';\n yunits: string = '';\n yaxislabeldistance: number = 50;\n xaxislabeldistance: number = 30;\n customcolors: string | Array<string> = '';\n legendheight: number = 0;\n labellegendheight: number = 0;\n labeltype: 'percent' | 'value' | 'key-value' | 'key' = 'percent';\n bubblesize: string= '';\n shape: string = '';\n loadingicon='fa fa-circle-o-notch fa-pulse';\n loadingdatamsg = 'Loading...';\n nodatamessage = 'No data found';\n offsetbottom: number = 50;\n offsettop: number = 70;\n offsetleft: number = 65;\n offsetright: number = 25;\n showlegend: string = 'top';\n showlabels: 'inside' | 'outside' | 'hide' = 'outside';\n tooltips: boolean = false;\n interpolation: string = 'linear';\n highlightpoints: boolean = false;\n showvalues: boolean = false;\n showyaxis: boolean = true;\n showxaxis: boolean = true;\n ydomain: string = '';\n xdomain: string = '';\n labelangle: number = 0;\n}\n"],"mappings":";;;AAAA,SAASA,SAAS,QAAQ,+CAA+C;AAEzE,eAAe,MAAMC,uBAAuB,SAASD,SAAS,CAAC;EAAAE,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA,uBACtC,EAAE;IAAAA,eAAA,uBACF,EAAE;IAAAA,eAAA,oBACb,EAAE;IAAAA,eAAA;IAAAA,eAAA,eAEC,EAAE;IAAAA,eAAA,gBACD,EAAE;IAAAA,eAAA,qBACG,EAAE;IAAAA,eAAA,gBACP,EAAE;IAAAA,eAAA,qBACG,EAAE;IAAAA,eAAA,iBACN,EAAE;IAAAA,eAAA,wBACM,KAAK;IAAAA,eAAA,qBACT,EAAE;IAAAA,eAAA,iBACN,EAAE;IAAAA,eAAA,6BACU,EAAE;IAAAA,eAAA,6BACF,EAAE;IAAAA,eAAA,uBACQ,EAAE;IAAAA,eAAA,uBAClB,CAAC;IAAAA,eAAA,4BACI,CAAC;IAAAA,eAAA,oBAC0B,SAAS;IAAAA,eAAA,qBAC5C,EAAE;IAAAA,eAAA,gBACN,EAAE;IAAAA,eAAA,sBACN,+BAA+B;IAAAA,eAAA,yBAC1B,YAAY;IAAAA,eAAA,wBACb,eAAe;IAAAA,eAAA,uBACR,EAAE;IAAAA,eAAA,oBACL,EAAE;IAAAA,eAAA,qBACD,EAAE;IAAAA,eAAA,sBACD,EAAE;IAAAA,eAAA,qBACH,KAAK;IAAAA,eAAA,qBACkB,SAAS;IAAAA,eAAA,mBACjC,KAAK;IAAAA,eAAA,wBACD,QAAQ;IAAAA,eAAA,0BACL,KAAK;IAAAA,eAAA,qBACV,KAAK;IAAAA,eAAA,oBACN,IAAI;IAAAA,eAAA,oBACJ,IAAI;IAAAA,eAAA,kBACP,EAAE;IAAAA,eAAA,kBACF,EAAE;IAAAA,eAAA,qBACC,CAAC;EAAA;AACxB"}
|
|
@@ -5,9 +5,26 @@ BASE_THEME.registerStyle((themeVariables, addStyle) => {
|
|
|
5
5
|
const defaultStyles = defineStyles({
|
|
6
6
|
root: {},
|
|
7
7
|
text: {},
|
|
8
|
+
icon: {
|
|
9
|
+
icon: {
|
|
10
|
+
fontSize: 20
|
|
11
|
+
}
|
|
12
|
+
},
|
|
8
13
|
line: {
|
|
9
14
|
color: themeVariables.chartLineColor
|
|
10
15
|
},
|
|
16
|
+
title: {
|
|
17
|
+
color: themeVariables.chartTitleColor,
|
|
18
|
+
fontSize: 20,
|
|
19
|
+
lineHeight: 24
|
|
20
|
+
},
|
|
21
|
+
subHeading: {
|
|
22
|
+
fontSize: 12,
|
|
23
|
+
lineHeight: 16,
|
|
24
|
+
color: themeVariables.chartSubTitleColor
|
|
25
|
+
},
|
|
26
|
+
legendText: {},
|
|
27
|
+
legenedDot: {},
|
|
11
28
|
grid: {},
|
|
12
29
|
barChart: {}
|
|
13
30
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BASE_THEME","defineStyles","DEFAULT_CLASS","registerStyle","themeVariables","addStyle","defaultStyles","root","text","line","color","chartLineColor","grid","barChart"],"sources":["basechart.styles.ts"],"sourcesContent":["import BASE_THEME from '@wavemaker/app-rn-runtime/styles/theme';\nimport { BaseStyles, defineStyles } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { VictoryStyleObject } from \"victory-core\";\n\n\nexport type BaseChartComponentStyles = BaseStyles & {\n grid: VictoryStyleObject\n};\n\nexport const DEFAULT_CLASS = 'app-chart';\nBASE_THEME.registerStyle((themeVariables, addStyle) => {\n const defaultStyles: BaseChartComponentStyles = defineStyles({\n root: {},\n text: {},\n line: {\n color: themeVariables.chartLineColor\n },\n grid: {},\n barChart: {}\n });\n\n addStyle(DEFAULT_CLASS, '', defaultStyles);\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["BASE_THEME","defineStyles","DEFAULT_CLASS","registerStyle","themeVariables","addStyle","defaultStyles","root","text","icon","fontSize","line","color","chartLineColor","title","chartTitleColor","lineHeight","subHeading","chartSubTitleColor","legendText","legenedDot","grid","barChart"],"sources":["basechart.styles.ts"],"sourcesContent":["import { TextStyle, ViewStyle } from 'react-native';\nimport BASE_THEME from '@wavemaker/app-rn-runtime/styles/theme';\nimport { BaseStyles, defineStyles } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { VictoryStyleObject } from \"victory-core\";\nimport { WmIconStyles } from '@wavemaker/app-rn-runtime/components/basic/icon/icon.styles';\n\n\nexport type BaseChartComponentStyles = BaseStyles & {\n title: TextStyle,\n icon: WmIconStyles,\n subHeading: TextStyle,\n grid: VictoryStyleObject,\n legendText: TextStyle,\n legenedDot: ViewStyle \n};\n\nexport const DEFAULT_CLASS = 'app-chart';\nBASE_THEME.registerStyle((themeVariables, addStyle) => {\n const defaultStyles: BaseChartComponentStyles = defineStyles({\n root: {},\n text: {},\n icon: {\n icon: {\n fontSize: 20\n }\n } as WmIconStyles,\n line: {\n color: themeVariables.chartLineColor\n },\n title: {\n color: themeVariables.chartTitleColor,\n fontSize: 20,\n lineHeight: 24,\n },\n subHeading: {\n fontSize: 12,\n lineHeight: 16,\n color: themeVariables.chartSubTitleColor\n },\n legendText: {},\n legenedDot: {},\n grid: {},\n barChart: {}\n });\n\n addStyle(DEFAULT_CLASS, '', defaultStyles);\n});\n"],"mappings":"AACA,OAAOA,UAAU,MAAM,wCAAwC;AAC/D,SAAqBC,YAAY,QAAQ,+CAA+C;AAcxF,OAAO,MAAMC,aAAa,GAAG,WAAW;AACxCF,UAAU,CAACG,aAAa,CAAC,CAACC,cAAc,EAAEC,QAAQ,KAAK;EACrD,MAAMC,aAAuC,GAAGL,YAAY,CAAC;IAC3DM,IAAI,EAAE,CAAC,CAAC;IACRC,IAAI,EAAE,CAAC,CAAC;IACRC,IAAI,EAAE;MACJA,IAAI,EAAE;QACJC,QAAQ,EAAE;MACZ;IACF,CAAiB;IACjBC,IAAI,EAAE;MACJC,KAAK,EAAER,cAAc,CAACS;IACxB,CAAC;IACDC,KAAK,EAAE;MACLF,KAAK,EAAER,cAAc,CAACW,eAAe;MACrCL,QAAQ,EAAE,EAAE;MACZM,UAAU,EAAE;IACd,CAAC;IACDC,UAAU,EAAE;MACVP,QAAQ,EAAE,EAAE;MACZM,UAAU,EAAE,EAAE;MACdJ,KAAK,EAAER,cAAc,CAACc;IACxB,CAAC;IACDC,UAAU,EAAE,CAAC,CAAC;IACdC,UAAU,EAAE,CAAC,CAAC;IACdC,IAAI,EAAE,CAAC,CAAC;IACRC,QAAQ,EAAE,CAAC;EACb,CAAC,CAAC;EAEFjB,QAAQ,CAACH,aAAa,EAAE,EAAE,EAAEI,aAAa,CAAC;AAC5C,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["WmPieChartProps","WmDonutChartProps","constructor","arguments","_defineProperty"],"sources":["donut-chart.props.ts"],"sourcesContent":["import WmPieChartProps from \"@wavemaker/app-rn-runtime/components/chart/pie-chart/pie-chart.props\";\n\nexport default class WmDonutChartProps extends WmPieChartProps {\n donutratio: number = 0.5;\n
|
|
1
|
+
{"version":3,"names":["WmPieChartProps","WmDonutChartProps","constructor","arguments","_defineProperty"],"sources":["donut-chart.props.ts"],"sourcesContent":["import WmPieChartProps from \"@wavemaker/app-rn-runtime/components/chart/pie-chart/pie-chart.props\";\n\nexport default class WmDonutChartProps extends WmPieChartProps {\n donutratio: number = 0.5;\n}\n"],"mappings":";;;AAAA,OAAOA,eAAe,MAAM,sEAAsE;AAElG,eAAe,MAAMC,iBAAiB,SAASD,eAAe,CAAC;EAAAE,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA,qBACxC,GAAG;EAAA;AAC1B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { View, Text } from "react-native";
|
|
3
|
+
export const Legend = function (props) {
|
|
4
|
+
var _props$data;
|
|
5
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
6
|
+
style: [props.orientation === 'vertical' ? {
|
|
7
|
+
flexDirection: 'column',
|
|
8
|
+
justifyContent: 'center'
|
|
9
|
+
} : {
|
|
10
|
+
flexDirection: 'row',
|
|
11
|
+
justifyContent: 'center',
|
|
12
|
+
flexWrap: 'wrap'
|
|
13
|
+
}]
|
|
14
|
+
}, (_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.map(d => {
|
|
15
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
16
|
+
key: d.name,
|
|
17
|
+
style: {
|
|
18
|
+
flexDirection: 'row',
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
padding: 4
|
|
21
|
+
}
|
|
22
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
23
|
+
style: [{
|
|
24
|
+
width: 12,
|
|
25
|
+
height: 12
|
|
26
|
+
}, props.dotStyle, {
|
|
27
|
+
backgroundColor: d.color
|
|
28
|
+
}]
|
|
29
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
30
|
+
style: [{
|
|
31
|
+
paddingLeft: 4
|
|
32
|
+
}, props.testStyle]
|
|
33
|
+
}, d.name));
|
|
34
|
+
}));
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=legend.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","View","Text","Legend","props","_props$data","createElement","style","orientation","flexDirection","justifyContent","flexWrap","data","map","d","key","name","alignItems","padding","width","height","dotStyle","backgroundColor","color","paddingLeft","testStyle"],"sources":["legend.component.tsx"],"sourcesContent":["import * as React from 'react';\nimport { TextStyle, View, Text, ViewStyle } from \"react-native\";\n\nexport interface LegendProps {\n data : [{\n name: string,\n color: string\n }];\n dotStyle?: ViewStyle;\n testStyle?: TextStyle;\n orientation?: 'vertical' | 'horizontal';\n}\n\nexport const Legend = function(props: LegendProps) {\n return (\n <View style={[\n props.orientation === 'vertical' ? {\n flexDirection: 'column',\n justifyContent: 'center'\n } : {\n flexDirection: 'row',\n justifyContent: 'center',\n flexWrap: 'wrap'\n }]}>\n {props.data?.map(d => {\n return (\n <View key={d.name} style={{\n flexDirection: 'row',\n alignItems: 'center',\n padding: 4}}>\n <View style={[{\n width: 12,\n height: 12\n }, props.dotStyle, {\n backgroundColor: d.color\n }]}></View>\n <Text style={[{ \n paddingLeft: 4\n }, props.testStyle]}>{d.name}</Text>\n </View>);\n })}\n </View>\n );\n};"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAAoBC,IAAI,EAAEC,IAAI,QAAmB,cAAc;AAY/D,OAAO,MAAMC,MAAM,GAAG,SAAAA,CAASC,KAAkB,EAAE;EAAA,IAAAC,WAAA;EAC/C,oBACIL,KAAA,CAAAM,aAAA,CAACL,IAAI;IAACM,KAAK,EAAE,CACbH,KAAK,CAACI,WAAW,KAAK,UAAU,GAAI;MAChCC,aAAa,EAAE,QAAQ;MACvBC,cAAc,EAAE;IACpB,CAAC,GAAG;MACAD,aAAa,EAAE,KAAK;MACpBC,cAAc,EAAE,QAAQ;MACxBC,QAAQ,EAAE;IACd,CAAC;EAAE,IAAAN,WAAA,GACED,KAAK,CAACQ,IAAI,cAAAP,WAAA,uBAAVA,WAAA,CAAYQ,GAAG,CAACC,CAAC,IAAI;IAClB,oBACAd,KAAA,CAAAM,aAAA,CAACL,IAAI;MAACc,GAAG,EAAED,CAAC,CAACE,IAAK;MAACT,KAAK,EAAE;QACtBE,aAAa,EAAE,KAAK;QACpBQ,UAAU,EAAE,QAAQ;QACpBC,OAAO,EAAE;MAAC;IAAE,gBACZlB,KAAA,CAAAM,aAAA,CAACL,IAAI;MAACM,KAAK,EAAE,CAAC;QACVY,KAAK,EAAE,EAAE;QACTC,MAAM,EAAE;MACZ,CAAC,EAAEhB,KAAK,CAACiB,QAAQ,EAAE;QACfC,eAAe,EAAER,CAAC,CAACS;MACvB,CAAC;IAAE,CAAO,CAAC,eACXvB,KAAA,CAAAM,aAAA,CAACJ,IAAI;MAACK,KAAK,EAAE,CAAC;QACViB,WAAW,EAAE;MACjB,CAAC,EAAEpB,KAAK,CAACqB,SAAS;IAAE,GAAEX,CAAC,CAACE,IAAW,CACjC,CAAC;EACX,CAAC,CACC,CAAC;AAEf,CAAC"}
|
|
@@ -2,53 +2,74 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
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
4
|
import React from 'react';
|
|
5
|
-
import { View } from 'react-native';
|
|
5
|
+
import { View, Text } from 'react-native';
|
|
6
6
|
import { Svg } from 'react-native-svg';
|
|
7
|
-
import { VictoryPie } from 'victory-native';
|
|
7
|
+
import { VictoryLabel, VictoryPie } from 'victory-native';
|
|
8
8
|
import WmPieChartProps from './pie-chart.props';
|
|
9
9
|
import { DEFAULT_CLASS } from './pie-chart.styles';
|
|
10
|
+
import { formatCompactNumber } from '@wavemaker/app-rn-runtime/core/utils';
|
|
11
|
+
import WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';
|
|
10
12
|
import { BaseChartComponent, BaseChartComponentState } from '@wavemaker/app-rn-runtime/components/chart/basechart.component';
|
|
11
13
|
import WmDonutChartProps from '@wavemaker/app-rn-runtime/components/chart/donut-chart/donut-chart.props';
|
|
14
|
+
import { Legend } from '../legend/legend.component';
|
|
12
15
|
export class WmPieChartState extends BaseChartComponentState {
|
|
13
16
|
constructor() {
|
|
14
17
|
super(...arguments);
|
|
15
|
-
_defineProperty(this, "innerradius", 0);
|
|
16
18
|
_defineProperty(this, "chartWidth", 0);
|
|
19
|
+
_defineProperty(this, "totalHeight", 0);
|
|
20
|
+
_defineProperty(this, "infoHeight", 10);
|
|
21
|
+
_defineProperty(this, "legendWidth", 0);
|
|
22
|
+
_defineProperty(this, "legendHeight", 0);
|
|
23
|
+
_defineProperty(this, "opacity", 0);
|
|
17
24
|
}
|
|
18
25
|
}
|
|
19
26
|
export default class WmPieChart extends BaseChartComponent {
|
|
20
27
|
constructor(props) {
|
|
21
28
|
super(props, DEFAULT_CLASS, props.type === 'Donut' ? new WmDonutChartProps() : new WmPieChartProps(), new WmPieChartState());
|
|
22
|
-
_defineProperty(this, "_pieChartHeight", 0);
|
|
23
|
-
_defineProperty(this, "labelLegendHeight", 0);
|
|
24
|
-
_defineProperty(this, "legendHeight", 0);
|
|
25
29
|
_defineProperty(this, "onViewLayoutChange", e => {
|
|
30
|
+
var _e$nativeEvent;
|
|
26
31
|
let viewWidth = e.nativeEvent.layout.width;
|
|
27
32
|
this.updateState({
|
|
28
|
-
chartWidth: viewWidth
|
|
33
|
+
chartWidth: viewWidth,
|
|
34
|
+
totalHeight: (_e$nativeEvent = e.nativeEvent) === null || _e$nativeEvent === void 0 ? void 0 : _e$nativeEvent.layout.height
|
|
29
35
|
});
|
|
30
36
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
this
|
|
39
|
-
|
|
37
|
+
_defineProperty(this, "onInfoViewLayoutChange", e => {
|
|
38
|
+
var _e$nativeEvent2;
|
|
39
|
+
this.updateState({
|
|
40
|
+
infoHeight: (_e$nativeEvent2 = e.nativeEvent) === null || _e$nativeEvent2 === void 0 ? void 0 : _e$nativeEvent2.layout.height,
|
|
41
|
+
opacity: 1
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
_defineProperty(this, "onLegendViewLayoutChange", e => {
|
|
45
|
+
var _e$nativeEvent3, _e$nativeEvent4;
|
|
46
|
+
this.updateState({
|
|
47
|
+
legendWidth: (_e$nativeEvent3 = e.nativeEvent) === null || _e$nativeEvent3 === void 0 ? void 0 : _e$nativeEvent3.layout.width,
|
|
48
|
+
legendHeight: (_e$nativeEvent4 = e.nativeEvent) === null || _e$nativeEvent4 === void 0 ? void 0 : _e$nativeEvent4.layout.height
|
|
49
|
+
});
|
|
40
50
|
});
|
|
41
51
|
}
|
|
42
52
|
componentDidMount() {
|
|
43
53
|
super.componentDidMount();
|
|
44
|
-
this.setHeightWidthOnChart(this.chartInit.bind(this));
|
|
45
54
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
getLabel(d, props) {
|
|
56
|
+
switch (props.labeltype) {
|
|
57
|
+
case 'percent':
|
|
58
|
+
{
|
|
59
|
+
return Math.round(d.y * 100 / this.state.total) + '%';
|
|
60
|
+
}
|
|
61
|
+
case 'key':
|
|
62
|
+
{
|
|
63
|
+
return this.state.xaxisDatakeyArr[d.x];
|
|
64
|
+
}
|
|
65
|
+
case 'value':
|
|
66
|
+
{
|
|
67
|
+
return formatCompactNumber(d.y);
|
|
68
|
+
}
|
|
69
|
+
case 'key-value':
|
|
70
|
+
{
|
|
71
|
+
return this.state.xaxisDatakeyArr[d.x] + ' ' + d.y;
|
|
72
|
+
}
|
|
52
73
|
}
|
|
53
74
|
}
|
|
54
75
|
renderWidget(props) {
|
|
@@ -56,7 +77,10 @@ export default class WmPieChart extends BaseChartComponent {
|
|
|
56
77
|
return null;
|
|
57
78
|
}
|
|
58
79
|
const pieData = this.state.data[0];
|
|
59
|
-
|
|
80
|
+
const chartWidth = this.state.chartWidth - (props.showlegend === 'right' ? this.state.legendWidth : 0);
|
|
81
|
+
const chartHeight = (this.styles.root.height ? this.state.totalHeight : chartWidth) - this.state.infoHeight - (props.showlegend === 'right' ? 0 : this.state.legendHeight);
|
|
82
|
+
let radius = (Math.min(chartWidth, chartHeight) - 40) / 2;
|
|
83
|
+
let innerRadius = props.donutratio * radius;
|
|
60
84
|
let styleProp = {};
|
|
61
85
|
let labelRadius;
|
|
62
86
|
if (props.showlabels === 'hide') {
|
|
@@ -67,23 +91,58 @@ export default class WmPieChart extends BaseChartComponent {
|
|
|
67
91
|
};
|
|
68
92
|
} else if (props.showlabels === 'inside') {
|
|
69
93
|
labelRadius = radius / 2;
|
|
94
|
+
} else {
|
|
95
|
+
labelRadius = radius + 8;
|
|
70
96
|
}
|
|
97
|
+
const origin = {
|
|
98
|
+
x: chartWidth / 2,
|
|
99
|
+
y: chartHeight / 2
|
|
100
|
+
};
|
|
71
101
|
const orientation = props.showlegend === 'right' ? 'vertical' : 'horizontal';
|
|
72
102
|
let legendData = pieData.map((d, index) => {
|
|
73
|
-
var _d$x;
|
|
74
103
|
return {
|
|
75
|
-
name: d
|
|
76
|
-
|
|
77
|
-
fill: this.state.colors[index]
|
|
78
|
-
}
|
|
104
|
+
name: this.state.xaxisDatakeyArr[d.x],
|
|
105
|
+
color: this.state.colors[index % this.state.colors.length]
|
|
79
106
|
};
|
|
80
107
|
});
|
|
81
108
|
return /*#__PURE__*/React.createElement(View, {
|
|
82
|
-
style:
|
|
109
|
+
style: [{
|
|
110
|
+
opacity: this.state.opacity
|
|
111
|
+
}, this.styles.root],
|
|
83
112
|
onLayout: this.onViewLayoutChange
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
|
|
113
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
114
|
+
onLayout: this.onInfoViewLayoutChange
|
|
115
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
116
|
+
style: {
|
|
117
|
+
flexDirection: 'row',
|
|
118
|
+
alignItems: 'center'
|
|
119
|
+
}
|
|
120
|
+
}, props.iconclass ? /*#__PURE__*/React.createElement(WmIcon, {
|
|
121
|
+
iconclass: props.iconclass,
|
|
122
|
+
styles: this.styles.icon
|
|
123
|
+
}) : null, /*#__PURE__*/React.createElement(Text, {
|
|
124
|
+
style: this.styles.title
|
|
125
|
+
}, props.title)), /*#__PURE__*/React.createElement(Text, {
|
|
126
|
+
style: this.styles.subHeading
|
|
127
|
+
}, props.subheading)), props.showlegend === 'top' ? /*#__PURE__*/React.createElement(View, {
|
|
128
|
+
onLayout: this.onLegendViewLayoutChange
|
|
129
|
+
}, /*#__PURE__*/React.createElement(Legend, {
|
|
130
|
+
data: legendData,
|
|
131
|
+
testStyle: this.styles.legendText,
|
|
132
|
+
dotStyle: this.styles.legenedDot
|
|
133
|
+
})) : null, /*#__PURE__*/React.createElement(View, {
|
|
134
|
+
style: {
|
|
135
|
+
flexDirection: 'row',
|
|
136
|
+
justifyContent: 'center',
|
|
137
|
+
alignItems: 'center'
|
|
138
|
+
}
|
|
139
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
140
|
+
style: {
|
|
141
|
+
flex: 1
|
|
142
|
+
}
|
|
143
|
+
}, chartWidth ? /*#__PURE__*/React.createElement(Svg, {
|
|
144
|
+
width: chartWidth,
|
|
145
|
+
height: chartHeight
|
|
87
146
|
}, /*#__PURE__*/React.createElement(VictoryPie, {
|
|
88
147
|
style: styleProp,
|
|
89
148
|
standalone: false,
|
|
@@ -92,20 +151,40 @@ export default class WmPieChart extends BaseChartComponent {
|
|
|
92
151
|
let {
|
|
93
152
|
datum
|
|
94
153
|
} = _ref;
|
|
95
|
-
return
|
|
154
|
+
return this.getLabel(datum, props);
|
|
96
155
|
},
|
|
97
156
|
endAngle: this.state.endAngle || 0,
|
|
98
|
-
radius:
|
|
99
|
-
innerRadius:
|
|
157
|
+
radius: radius,
|
|
158
|
+
innerRadius: innerRadius,
|
|
100
159
|
theme: this.state.theme,
|
|
101
160
|
key: props.name,
|
|
102
161
|
name: props.name,
|
|
103
162
|
data: pieData,
|
|
104
|
-
origin:
|
|
105
|
-
|
|
106
|
-
|
|
163
|
+
origin: origin,
|
|
164
|
+
labelPlacement: props.labelplacement,
|
|
165
|
+
labelRadius: labelRadius
|
|
166
|
+
}), /*#__PURE__*/React.createElement(VictoryLabel, {
|
|
167
|
+
textAnchor: "middle",
|
|
168
|
+
style: this.styles.title,
|
|
169
|
+
x: origin.x,
|
|
170
|
+
y: origin.y,
|
|
171
|
+
text: props.centerlabel
|
|
172
|
+
})) : null), props.showlegend === 'right' ? /*#__PURE__*/React.createElement(View, {
|
|
173
|
+
style: {
|
|
174
|
+
maxWidth: '50%'
|
|
107
175
|
},
|
|
108
|
-
|
|
176
|
+
onLayout: this.onLegendViewLayoutChange
|
|
177
|
+
}, /*#__PURE__*/React.createElement(Legend, {
|
|
178
|
+
data: legendData,
|
|
179
|
+
testStyle: this.styles.legendText,
|
|
180
|
+
dotStyle: this.styles.legenedDot,
|
|
181
|
+
orientation: "vertical"
|
|
182
|
+
})) : null), props.showlegend === 'bottom' ? /*#__PURE__*/React.createElement(View, {
|
|
183
|
+
onLayout: this.onLegendViewLayoutChange
|
|
184
|
+
}, /*#__PURE__*/React.createElement(Legend, {
|
|
185
|
+
data: legendData,
|
|
186
|
+
testStyle: this.styles.legendText,
|
|
187
|
+
dotStyle: this.styles.legenedDot
|
|
109
188
|
})) : null);
|
|
110
189
|
}
|
|
111
190
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","Svg","VictoryPie","WmPieChartProps","DEFAULT_CLASS","BaseChartComponent","BaseChartComponentState","WmDonutChartProps","WmPieChartState","constructor","arguments","_defineProperty","WmPieChart","props","type","e","viewWidth","nativeEvent","layout","width","updateState","chartWidth","setInnerRadius","ratio","state","donutratio","parseFloat","innerRadius","innerradius","componentDidMount","setHeightWidthOnChart","chartInit","bind","legendHeight","legendheight","labelLegendHeight","labellegendheight","_pieChartHeight","chartHeight","renderWidget","data","length","pieData","radius","styleProp","labelRadius","showlabels","labels","display","orientation","showlegend","legendData","map","d","index","_d$x","name","x","toString","symbol","fill","colors","createElement","style","styles","root","onLayout","onViewLayoutChange","height","standalone","colorScale","_ref","datum","endAngle","Math","min","theme","key","origin","y","labelPlacement","labelplacement"],"sources":["pie-chart.component.tsx"],"sourcesContent":["import React from 'react';\nimport { LayoutChangeEvent, View } from 'react-native';\nimport { Svg } from 'react-native-svg';\n\nimport { VictoryLegend, VictoryPie } from 'victory-native';\n\nimport WmPieChartProps from './pie-chart.props';\nimport { DEFAULT_CLASS, WmPieChartStyles } from './pie-chart.styles';\nimport {\n BaseChartComponent,\n BaseChartComponentState\n} from '@wavemaker/app-rn-runtime/components/chart/basechart.component';\nimport WmDonutChartProps from '@wavemaker/app-rn-runtime/components/chart/donut-chart/donut-chart.props';\n\nexport class WmPieChartState extends BaseChartComponentState<WmPieChartProps> {\n innerradius: number = 0;\n chartWidth = 0;\n}\n\nexport default class WmPieChart extends BaseChartComponent<WmPieChartProps, WmPieChartState, WmPieChartStyles> {\n private _pieChartHeight: number = 0;\n private labelLegendHeight: number = 0;\n private legendHeight: number = 0;\n constructor(props: WmPieChartProps) {\n super(props, DEFAULT_CLASS, props.type === 'Donut' ? new WmDonutChartProps() : new WmPieChartProps(), new WmPieChartState());\n }\n\n setInnerRadius() {\n let ratio = this.state.props.donutratio;\n if (typeof ratio === 'string') {\n ratio = parseFloat(ratio);\n }\n const innerRadius: number = ratio * 90;\n this.updateState({\n innerradius: innerRadius\n } as WmPieChartState);\n }\n\n componentDidMount() {\n super.componentDidMount();\n this.setHeightWidthOnChart(this.chartInit.bind(this));\n }\n\n chartInit() {\n this.legendHeight = 30 || this.props.legendheight;\n this.labelLegendHeight = 20 || this.props.labellegendheight;\n this._pieChartHeight = this.state.chartHeight - this.legendHeight - this.labelLegendHeight;\n if (this.state.props.donutratio && !this.state.innerradius) {\n this.setInnerRadius();\n }\n }\n\n onViewLayoutChange = (e: LayoutChangeEvent) => {\n let viewWidth = e.nativeEvent.layout.width;\n this.updateState({\n chartWidth: viewWidth\n } as WmPieChartState)\n }\n\n renderWidget(props: WmPieChartProps) {\n if (!this.state.data.length) {\n return null;\n }\n const pieData = this.state.data[0];\n let radius = (this._pieChartHeight-200)/2;\n let styleProp = {};\n let labelRadius;\n if (props.showlabels === 'hide') {\n styleProp={labels: { display: \"none\" }};\n } else if (props.showlabels === 'inside') {\n labelRadius = radius/2;\n }\n const orientation = props.showlegend === 'right' ? 'vertical' : 'horizontal';\n let legendData: Array<{name: any}> = pieData.map((d: {x: any, y: any}, index: number) => {return {name: d?.x?.toString(), symbol: { fill: this.state.colors[index] }}});\n return (\n <View style={this.styles.root} onLayout={this.onViewLayoutChange}>\n {this.state.chartWidth ? (\n <Svg\n width={this.state.chartWidth}\n height={this.state.chartHeight}\n >\n <VictoryPie\n style={styleProp}\n standalone={false}\n colorScale={this.state.colors}\n labels={({datum}) => {\n return '';\n }}\n endAngle={this.state.endAngle || 0}\n radius={(Math.min(this.state.chartWidth, this.state.chartHeight) - 20)/ 2}\n innerRadius={props.innerradius || this.state.innerradius}\n theme={this.state.theme}\n key={props.name}\n name={props.name}\n data={pieData}\n origin={{x: (this.state.chartWidth/2), y: (this.state.chartH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,UAAU,EAAE,IAAI,CAACG,KAAK,CAACc,WAAW,CAAC,GAAG,EAAE,IAAG,CAAE;MAC1EX,WAAW,EAAEd,KAAK,CAACe,WAAW,IAAI,IAAI,CAACJ,KAAK,CAACI,WAAY;MACzDgD,KAAK,EAAE,IAAI,CAACpD,KAAK,CAACoD,KAAM;MACxBC,GAAG,EAAEhE,KAAK,CAAC2C,IAAK;MAChBA,IAAI,EAAE3C,KAAK,CAAC2C,IAAK;MACjBhB,IAAI,EAAEE,OAAQ;MACdoC,MAAM,EAAE;QAACrB,CAAC,EAAG,IAAI,CAACjC,KAAK,CAACH,UAAU,GAAC,CAAE;QAAE0D,CAAC,EAAG,IAAI,CAACvD,KAAK,CAACc,WAAW,GAAC;MAAE,CAAE;MACtE0C,cAAc,EAAEnE,KAAK,CAACoE;IAAe,CACtC,CACE,CAAC,GAAI,IACN,CAAC;EAEX;AACF"}
|
|
1
|
+
{"version":3,"names":["React","View","Text","Svg","VictoryLabel","VictoryPie","WmPieChartProps","DEFAULT_CLASS","formatCompactNumber","WmIcon","BaseChartComponent","BaseChartComponentState","WmDonutChartProps","Legend","WmPieChartState","constructor","arguments","_defineProperty","WmPieChart","props","type","e","_e$nativeEvent","viewWidth","nativeEvent","layout","width","updateState","chartWidth","totalHeight","height","_e$nativeEvent2","infoHeight","opacity","_e$nativeEvent3","_e$nativeEvent4","legendWidth","legendHeight","componentDidMount","getLabel","d","labeltype","Math","round","y","state","total","xaxisDatakeyArr","x","renderWidget","data","length","pieData","showlegend","chartHeight","styles","root","radius","min","innerRadius","donutratio","styleProp","labelRadius","showlabels","labels","display","origin","orientation","legendData","map","index","name","color","colors","createElement","style","onLayout","onViewLayoutChange","onInfoViewLayoutChange","flexDirection","alignItems","iconclass","icon","title","subHeading","subheading","onLegendViewLayoutChange","testStyle","legendText","dotStyle","legenedDot","justifyContent","flex","standalone","colorScale","_ref","datum","endAngle","theme","key","labelPlacement","labelplacement","textAnchor","text","centerlabel","maxWidth"],"sources":["pie-chart.component.tsx"],"sourcesContent":["import React from 'react';\nimport { LayoutChangeEvent, View, Text } from 'react-native';\nimport { Svg } from 'react-native-svg';\n\nimport { VictoryLabel, VictoryLegend, VictoryPie } from 'victory-native';\n\nimport WmPieChartProps from './pie-chart.props';\nimport { DEFAULT_CLASS, WmPieChartStyles } from './pie-chart.styles';\n\nimport { formatCompactNumber } from '@wavemaker/app-rn-runtime/core/utils';\nimport WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';\nimport {\n BaseChartComponent,\n BaseChartComponentState\n} from '@wavemaker/app-rn-runtime/components/chart/basechart.component';\nimport WmDonutChartProps from '@wavemaker/app-rn-runtime/components/chart/donut-chart/donut-chart.props';\nimport { Legend } from '../legend/legend.component';\n\nexport class WmPieChartState extends BaseChartComponentState<WmPieChartProps> {\n chartWidth = 0;\n totalHeight = 0;\n infoHeight = 10;\n legendWidth = 0;\n legendHeight = 0;\n opacity = 0;\n}\n\nexport default class WmPieChart extends BaseChartComponent<WmPieChartProps, WmPieChartState, WmPieChartStyles> {\n\n constructor(props: WmPieChartProps) {\n super(props, DEFAULT_CLASS, props.type === 'Donut' ? new WmDonutChartProps() : new WmPieChartProps(), new WmPieChartState());\n }\n\n componentDidMount() {\n super.componentDidMount();\n }\n\n onViewLayoutChange = (e: LayoutChangeEvent) => {\n let viewWidth = e.nativeEvent.layout.width;\n this.updateState({\n chartWidth: viewWidth,\n totalHeight: e.nativeEvent?.layout.height\n } as WmPieChartState)\n }\n\n onInfoViewLayoutChange = (e: LayoutChangeEvent) => {\n this.updateState({\n infoHeight: e.nativeEvent?.layout.height,\n opacity: 1\n } as WmPieChartState);\n }\n\n onLegendViewLayoutChange = (e: LayoutChangeEvent) => {\n this.updateState({\n legendWidth: e.nativeEvent?.layout.width,\n legendHeight: e.nativeEvent?.layout.height\n } as WmPieChartState);\n }\n\n getLabel(d: {x: any, y: any}, props: WmPieChartProps): string {\n switch(props.labeltype) {\n case 'percent': {\n return Math.round(d.y * 100 /this.state.total) + '%';\n }\n case 'key': {\n return this.state.xaxisDatakeyArr[d.x];\n }\n case 'value': {\n return formatCompactNumber(d.y);\n }\n case 'key-value': {\n return this.state.xaxisDatakeyArr[d.x] + ' ' + d.y;\n }\n }\n }\n\n renderWidget(props: WmPieChartProps) {\n if (!this.state.data.length) {\n return null;\n }\n const pieData = this.state.data[0];\n const chartWidth = this.state.chartWidth \n - (props.showlegend === 'right' ? this.state.legendWidth : 0);\n const chartHeight = (this.styles.root.height ? this.state.totalHeight : chartWidth) \n - this.state.infoHeight \n - (props.showlegend === 'right' ? 0 : this.state.legendHeight);\n let radius = (Math.min(chartWidth, chartHeight) - 40)/ 2;\n let innerRadius = props.donutratio * radius;\n let styleProp = {};\n let labelRadius;\n if (props.showlabels === 'hide') {\n styleProp={labels: { display: \"none\" }};\n } else if (props.showlabels === 'inside') {\n labelRadius = radius/2;\n } else {\n labelRadius = radius + 8;\n }\n const origin = {x: (chartWidth/2), y: (chartHeight/2)};\n const orientation = props.showlegend === 'right' ? 'vertical' : 'horizontal';\n let legendData = pieData.map((d: {x: any, y: any}, index: number) => {\n return {\n name: this.state.xaxisDatakeyArr[d.x],\n color: this.state.colors[index % (this.state.colors.length)]\n };\n });\n return (\n <View style={[{opacity: this.state.opacity}, this.styles.root]}\n onLayout={this.onViewLayoutChange}>\n <View onLayout={this.onInfoViewLayoutChange}>\n <View style={{flexDirection: 'row', alignItems: 'center'}}>\n {props.iconclass ? (<WmIcon iconclass={props.iconclass} styles={this.styles.icon}></WmIcon>) : null }\n <Text style={this.styles.title}>{props.title}</Text>\n </View>\n <Text style={this.styles.subHeading}>{props.subheading}</Text>\n </View>\n {props.showlegend === 'top' ? \n (<View onLayout={this.onLegendViewLayoutChange}>\n <Legend data={legendData}\n testStyle={this.styles.legendText}\n dotStyle={this.styles.legenedDot}></Legend>\n </View>) : null }\n <View style={{flexDirection: 'row', justifyContent: 'center', alignItems: 'center'}}>\n <View style={{flex: 1}}>\n {chartWidth ? (\n <Svg\n width={chartWidth}\n height={chartHeight}\n >\n <VictoryPie\n style={styleProp}\n standalone={false}\n colorScale={this.state.colors}\n labels={({datum}) => this.getLabel(datum, props)}\n endAngle={this.state.endAngle || 0}\n radius={radius}\n innerRadius={innerRadius}\n theme={this.state.theme}\n key={props.name}\n name={props.name}\n data={pieData}\n origin={origin}\n labelPlacement={props.labelplacement}\n labelRadius={labelRadius}\n />\n <VictoryLabel\n textAnchor=\"middle\"\n style={this.styles.title as any}\n x={origin.x} y={origin.y}\n text={props.centerlabel}\n />\n </Svg>) : null}\n </View>\n {props.showlegend === 'right' ? \n (<View style={{maxWidth: '50%'}} onLayout={this.onLegendViewLayoutChange}>\n <Legend data={legendData}\n testStyle={this.styles.legendText}\n dotStyle={this.styles.legenedDot}\n orientation='vertical'></Legend>\n </View>) : null }\n </View>\n {props.showlegend === 'bottom' ? \n (<View onLayout={this.onLegendViewLayoutChange}>\n <Legend data={legendData}\n testStyle={this.styles.legendText}\n dotStyle={this.styles.legenedDot}></Legend>\n </View>) : null }\n </View>\n );\n }\n}\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAA4BC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAC5D,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,SAASC,YAAY,EAAiBC,UAAU,QAAQ,gBAAgB;AAExE,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,SAASC,aAAa,QAA0B,oBAAoB;AAEpE,SAASC,mBAAmB,QAAQ,sCAAsC;AAC1E,OAAOC,MAAM,MAAM,gEAAgE;AACnF,SACEC,kBAAkB,EAClBC,uBAAuB,QAClB,gEAAgE;AACvE,OAAOC,iBAAiB,MAAM,0EAA0E;AACxG,SAASC,MAAM,QAAQ,4BAA4B;AAEnD,OAAO,MAAMC,eAAe,SAASH,uBAAuB,CAAkB;EAAAI,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA,qBAC/D,CAAC;IAAAA,eAAA,sBACA,CAAC;IAAAA,eAAA,qB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,CAACzE,IAAI;MAAC0E,KAAK,EAAE;QAAC8B,QAAQ,EAAE;MAAK,CAAE;MAAC7B,QAAQ,EAAE,IAAI,CAACU;IAAyB,gBACvEtF,KAAA,CAAA0E,aAAA,CAAC7D,MAAM;MAACqC,IAAI,EAAEkB,UAAW;MACvBmB,SAAS,EAAE,IAAI,CAAChC,MAAM,CAACiC,UAAW;MAClCC,QAAQ,EAAE,IAAI,CAAClC,MAAM,CAACmC,UAAW;MACjCvB,WAAW,EAAC;IAAU,CAAS,CAC7B,CAAC,GAAI,IACT,CAAC,EACNhD,KAAK,CAACkC,UAAU,KAAK,QAAQ,gBAC3BrD,KAAA,CAAA0E,aAAA,CAACzE,IAAI;MAAC2E,QAAQ,EAAE,IAAI,CAACU;IAAyB,gBAC7CtF,KAAA,CAAA0E,aAAA,CAAC7D,MAAM;MAACqC,IAAI,EAAEkB,UAAW;MACvBmB,SAAS,EAAE,IAAI,CAAChC,MAAM,CAACiC,UAAW;MAClCC,QAAQ,EAAE,IAAI,CAAClC,MAAM,CAACmC;IAAW,CAAS,CACxC,CAAC,GAAI,IACT,CAAC;EAEX;AACF"}
|
|
@@ -6,9 +6,8 @@ export default class WmPieChartProps extends BaseChartComponentProps {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
8
8
|
_defineProperty(this, "donutratio", 0);
|
|
9
|
-
_defineProperty(this, "labeltype", 'percent');
|
|
10
|
-
_defineProperty(this, "innerradius", 0);
|
|
11
9
|
_defineProperty(this, "labelplacement", 'vertical');
|
|
10
|
+
_defineProperty(this, "centerlabel", '');
|
|
12
11
|
}
|
|
13
12
|
}
|
|
14
13
|
//# sourceMappingURL=pie-chart.props.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BaseChartComponentProps","WmPieChartProps","constructor","arguments","_defineProperty"],"sources":["pie-chart.props.ts"],"sourcesContent":["import BaseChartComponentProps from '@wavemaker/app-rn-runtime/components/chart/basechart.props';\nimport { VictorySliceLabelPlacementType } from 'victory-pie';\n\nexport default class WmPieChartProps extends BaseChartComponentProps {\n donutratio: number = 0;\n
|
|
1
|
+
{"version":3,"names":["BaseChartComponentProps","WmPieChartProps","constructor","arguments","_defineProperty"],"sources":["pie-chart.props.ts"],"sourcesContent":["import BaseChartComponentProps from '@wavemaker/app-rn-runtime/components/chart/basechart.props';\nimport { VictorySliceLabelPlacementType } from 'victory-pie';\n\nexport default class WmPieChartProps extends BaseChartComponentProps {\n donutratio: number = 0;\n labelplacement: VictorySliceLabelPlacementType = 'vertical';\n centerlabel = '';\n}\n"],"mappings":";;;AAAA,OAAOA,uBAAuB,MAAM,4DAA4D;AAGhG,eAAe,MAAMC,eAAe,SAASD,uBAAuB,CAAC;EAAAE,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA,qBAC9C,CAAC;IAAAA,eAAA,yBAC2B,UAAU;IAAAA,eAAA,sBAC7C,EAAE;EAAA;AAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","BaseComponent","BaseComponentState","WmButton","WmFormActionProps","DEFAULT_CLASS","debounce","WmFormActionState","WmFormAction","constructor","props","_defineProperty","onClick","$event","cb","renderWidget","createElement","disabled","caption","displayName","styles","name","iconclass","onTap","_debouncedFormAction","formAction"],"sources":["form-action.component.tsx"],"sourcesContent":["import React from 'react';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport WmButton from '@wavemaker/app-rn-runtime/components/basic/button/button.component';\nimport { TapEvent } from '@wavemaker/app-rn-runtime/core/tappable.component';\n\nimport WmFormActionProps from './form-action.props';\nimport { DEFAULT_CLASS, WmFormActionStyles } from './form-action.styles';\nimport {debounce} from \"lodash\";\nimport WmSkeleton, { createSkeleton } from '@wavemaker/app-rn-runtime/components/basic/skeleton/skeleton.component';\nimport { ThemeConsumer } from '@wavemaker/app-rn-runtime/styles/theme';\n\nexport class WmFormActionState extends BaseComponentState<WmFormActionProps> {}\n\nexport default class WmFormAction extends BaseComponent<WmFormActionProps, WmFormActionState, WmFormActionStyles> {\n\n constructor(props: WmFormActionProps) {\n super(props, DEFAULT_CLASS, new WmFormActionProps());\n }\n\n private _debouncedFormAction = debounce(this.onClick, 250);\n\n onClick($event: TapEvent, cb: Function | undefined) {\n cb && cb($event);\n }\n\n renderWidget(props: WmFormActionProps) {\n return (\n <WmButton\n disabled={props.disabled}\n caption={props.displayName}\n styles={this.styles}\n name={props.name}\n iconclass={props.iconclass}\n onTap={($event: any) => {\n this._debouncedFormAction($event, props.formAction);\n }}\n />\n );\n }\n}\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AACjG,OAAOC,QAAQ,MAAM,oEAAoE;AAGzF,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,SAASC,aAAa,QAA4B,sBAAsB;AACxE,SAAQC,QAAQ,QAAO,QAAQ;AAI/B,OAAO,MAAMC,iBAAiB,SAASL,kBAAkB,CAAoB;AAE7E,eAAe,MAAMM,YAAY,SAASP,aAAa,CAA2D;EAEhHQ,WAAWA,CAACC,KAAwB,EAAE;IACpC,KAAK,CAACA,KAAK,EAAEL,aAAa,EAAE,IAAID,iBAAiB,CAAC,CAAC,CAAC;IAACO,eAAA,+BAGxBL,QAAQ,CAAC,IAAI,CAACM,OAAO,EAAE,GAAG,CAAC;EAF1D;EAIAA,OAAOA,CAACC,MAAgB,EAAEC,EAAwB,EAAE;IAClDA,EAAE,IAAIA,EAAE,CAACD,MAAM,CAAC;EAClB;EAEAE,YAAYA,CAACL,KAAwB,EAAE;IACrC,oBACEV,KAAA,CAAAgB,aAAA,CAACb,QAAQ;MACPc,
|
|
1
|
+
{"version":3,"names":["React","BaseComponent","BaseComponentState","WmButton","WmFormActionProps","DEFAULT_CLASS","debounce","WmFormActionState","WmFormAction","constructor","props","_defineProperty","onClick","$event","cb","renderWidget","createElement","show","disabled","caption","displayName","styles","name","iconclass","onTap","_debouncedFormAction","formAction"],"sources":["form-action.component.tsx"],"sourcesContent":["import React from 'react';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport WmButton from '@wavemaker/app-rn-runtime/components/basic/button/button.component';\nimport { TapEvent } from '@wavemaker/app-rn-runtime/core/tappable.component';\n\nimport WmFormActionProps from './form-action.props';\nimport { DEFAULT_CLASS, WmFormActionStyles } from './form-action.styles';\nimport {debounce} from \"lodash\";\nimport WmSkeleton, { createSkeleton } from '@wavemaker/app-rn-runtime/components/basic/skeleton/skeleton.component';\nimport { ThemeConsumer } from '@wavemaker/app-rn-runtime/styles/theme';\n\nexport class WmFormActionState extends BaseComponentState<WmFormActionProps> {}\n\nexport default class WmFormAction extends BaseComponent<WmFormActionProps, WmFormActionState, WmFormActionStyles> {\n\n constructor(props: WmFormActionProps) {\n super(props, DEFAULT_CLASS, new WmFormActionProps());\n }\n\n private _debouncedFormAction = debounce(this.onClick, 250);\n\n onClick($event: TapEvent, cb: Function | undefined) {\n cb && cb($event);\n }\n\n renderWidget(props: WmFormActionProps) {\n return (\n <WmButton\n show={props.show}\n disabled={props.disabled}\n caption={props.displayName}\n styles={this.styles}\n name={props.name}\n iconclass={props.iconclass}\n onTap={($event: any) => {\n this._debouncedFormAction($event, props.formAction);\n }}\n />\n );\n }\n}\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AACjG,OAAOC,QAAQ,MAAM,oEAAoE;AAGzF,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,SAASC,aAAa,QAA4B,sBAAsB;AACxE,SAAQC,QAAQ,QAAO,QAAQ;AAI/B,OAAO,MAAMC,iBAAiB,SAASL,kBAAkB,CAAoB;AAE7E,eAAe,MAAMM,YAAY,SAASP,aAAa,CAA2D;EAEhHQ,WAAWA,CAACC,KAAwB,EAAE;IACpC,KAAK,CAACA,KAAK,EAAEL,aAAa,EAAE,IAAID,iBAAiB,CAAC,CAAC,CAAC;IAACO,eAAA,+BAGxBL,QAAQ,CAAC,IAAI,CAACM,OAAO,EAAE,GAAG,CAAC;EAF1D;EAIAA,OAAOA,CAACC,MAAgB,EAAEC,EAAwB,EAAE;IAClDA,EAAE,IAAIA,EAAE,CAACD,MAAM,CAAC;EAClB;EAEAE,YAAYA,CAACL,KAAwB,EAAE;IACrC,oBACEV,KAAA,CAAAgB,aAAA,CAACb,QAAQ;MACPc,IAAI,EAAEP,KAAK,CAACO,IAAK;MACjBC,QAAQ,EAAER,KAAK,CAACQ,QAAS;MACzBC,OAAO,EAAET,KAAK,CAACU,WAAY;MAC3BC,MAAM,EAAE,IAAI,CAACA,MAAO;MACpBC,IAAI,EAAEZ,KAAK,CAACY,IAAK;MACjBC,SAAS,EAAEb,KAAK,CAACa,SAAU;MAC3BC,KAAK,EAAGX,MAAW,IAAK;QACtB,IAAI,CAACY,oBAAoB,CAACZ,MAAM,EAAEH,KAAK,CAACgB,UAAU,CAAC;MACrD;IAAE,CACH,CAAC;EAEN;AACF"}
|
|
@@ -6,9 +6,11 @@ export default class WmFormActionProps extends BaseProps {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
8
8
|
_defineProperty(this, "displayName", '');
|
|
9
|
-
_defineProperty(this, "
|
|
9
|
+
_defineProperty(this, "formKey", '');
|
|
10
10
|
_defineProperty(this, "action", '');
|
|
11
|
+
_defineProperty(this, "show", true);
|
|
11
12
|
_defineProperty(this, "iconclass", void 0);
|
|
13
|
+
_defineProperty(this, "updateMode", true);
|
|
12
14
|
_defineProperty(this, "formAction", null);
|
|
13
15
|
}
|
|
14
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BaseProps","WmFormActionProps","constructor","arguments","_defineProperty"],"sources":["form-action.props.ts"],"sourcesContent":["import { BaseProps } from '@wavemaker/app-rn-runtime/core/base.component';\n\nexport default class WmFormActionProps extends BaseProps {\n displayName: string = '';\n
|
|
1
|
+
{"version":3,"names":["BaseProps","WmFormActionProps","constructor","arguments","_defineProperty"],"sources":["form-action.props.ts"],"sourcesContent":["import { BaseProps } from '@wavemaker/app-rn-runtime/core/base.component';\n\nexport default class WmFormActionProps extends BaseProps {\n displayName: string = '';\n formKey: string = '';\n action: any = '';\n show: boolean = true;\n iconclass: any;\n updateMode: boolean = true;\n formAction: Function = null as any;\n}\n"],"mappings":";;;AAAA,SAASA,SAAS,QAAQ,+CAA+C;AAEzE,eAAe,MAAMC,iBAAiB,SAASD,SAAS,CAAC;EAAAE,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA,sBACjC,EAAE;IAAAA,eAAA,kBACN,EAAE;IAAAA,eAAA,iBACN,EAAE;IAAAA,eAAA,eACA,IAAI;IAAAA,eAAA;IAAAA,eAAA,qBAEE,IAAI;IAAAA,eAAA,qBACH,IAAI;EAAA;AAC7B"}
|
|
@@ -117,6 +117,15 @@ export default class WmFormField extends BaseComponent {
|
|
|
117
117
|
}
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
|
+
updateFormWidgetDataset(res, displayField) {
|
|
121
|
+
this.formwidget.updateState({
|
|
122
|
+
props: {
|
|
123
|
+
dataset: res.data,
|
|
124
|
+
datafield: 'All Fields',
|
|
125
|
+
displayfield: this.formwidget.state.props.displayfield || displayField
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
120
129
|
setInvalidState(msg) {
|
|
121
130
|
this.updateState({
|
|
122
131
|
isValid: false,
|
|
@@ -143,8 +152,20 @@ export default class WmFormField extends BaseComponent {
|
|
|
143
152
|
get(this, 'form') && this.form.applyDefaultValue(this);
|
|
144
153
|
}
|
|
145
154
|
break;
|
|
155
|
+
case 'primary-key':
|
|
156
|
+
if ($new) {
|
|
157
|
+
this.form.setPrimaryKey(this.props.name);
|
|
158
|
+
}
|
|
159
|
+
break;
|
|
146
160
|
}
|
|
147
161
|
}
|
|
162
|
+
setReadOnlyState(updateMode) {
|
|
163
|
+
this.formwidget.updateState({
|
|
164
|
+
props: {
|
|
165
|
+
readonly: !updateMode
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
148
169
|
validateFormField() {
|
|
149
170
|
var _this$formwidget, _this$_syncValidators;
|
|
150
171
|
if (((_this$formwidget = this.formwidget) === null || _this$formwidget === void 0 ? void 0 : _this$formwidget.state.isValid) === false) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Text","View","BaseComponent","BaseComponentState","isEqual","get","find","cloneDeep","forEach","keys","WmFormFieldProps","DEFAULT_CLASS","PERFORMANCE_LOGGER","WmFormFieldState","constructor","arguments","_defineProperty","WmFormField","props","onFieldChangeEvt","name","$new","$old","isDefault","notifyChanges","validateFormField","updateState","datavalue","invokeEventCallback","undefined","form","updateDataOutput","call","observeOn","fields","field","formfield","formFields","f","proxy","notifyForFields","push","formwidget","validate","setTimeout","getPromiseList","validators","arr","fn","promise","Function","bind","Promise","setAsyncValidators","_asyncValidatorFn","all","then","err","validationMsg","hasOwnProperty","messageKeys","toString","setInvalidState","setValidators","_cloneValidators","_syncValidators","obj","index","key","defaultValidatorMessages","value","propsObj","msg","isValid","validationmessage","onPropertyChange","debug","applyDefaultValue","_this$formwidget","_this$_syncValidators","state","_this$formwidget2","errorType","errormsg","errorMessage","renderWidget","childrenWithProps","Children","map","renderFormFields","children","child","cloneElement","invokeEvent","triggerValidation","onFieldChange","formRef","createElement","style","styles","root","_background","errorMsg"],"sources":["form-field.component.tsx"],"sourcesContent":["import React from 'react';\nimport {Text, View} from 'react-native';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { widgetsWithUndefinedValue } from '@wavemaker/app-rn-runtime/core/utils';\nimport { isEqual, get, find, cloneDeep, forEach, keys } from 'lodash';\n\nimport WmFormFieldProps from './form-field.props';\nimport { DEFAULT_CLASS, WmFormFieldStyles } from './form-field.styles';\nimport {PERFORMANCE_LOGGER} from \"@wavemaker/app-rn-runtime/core/logger\";\n\nexport class WmFormFieldState extends BaseComponentState<WmFormFieldProps> {\n isValid = true;\n}\n\nexport default class WmFormField extends BaseComponent<WmFormFieldProps, WmFormFieldState, WmFormFieldStyles> {\n public form: any;\n public formwidget: any;\n public _syncValidators: any;\n public defaultValidatorMessages: any = [];\n private notifyForFields: any = [];\n private _asyncValidatorFn: any;\n constructor(props: WmFormFieldProps) {\n super(props, DEFAULT_CLASS, new WmFormFieldProps(), new WmFormFieldState());\n }\n\n onFieldChangeEvt(name: string, $new: any, $old: any, isDefault: boolean) {\n this.notifyChanges();\n this.validateFormField();\n if (!isEqual($old, $new)) {\n this.updateState({ props: { datavalue: $new }} as WmFormFieldState, () => {\n !isDefault && this.invokeEventCallback('onChange', [undefined, this, $new, $old]);\n });\n if (this.form) {\n this.form.updateDataOutput.call(this.form, get(this.props, 'formKey', this.props.name), $new);\n }\n }\n }\n\n // Registers observer of validation fields\n observeOn(fields: any) {\n forEach(fields, (field) => {\n const formfield = find(this.form.formFields, (f) => f.proxy.name === field);\n if (formfield) {\n formfield.notifyForFields.push(this);\n }\n });\n }\n\n // Notifies changes to observing validation fields\n notifyChanges() {\n forEach(this.notifyForFields, (field) => {\n field.formwidget.validate(field.formwidget.datavalue);\n setTimeout(() => field.validateFormField());\n });\n }\n\n getPromiseList(validators: any) {\n const arr: any = [];\n forEach(validators, (fn) => {\n let promise = fn;\n if (fn instanceof Function && fn.bind) {\n promise = fn(this.formwidget.proxy, this.form);\n }\n if (promise instanceof Promise) {\n arr.push(promise);\n }\n });\n return arr;\n }\n\n // this method sets the asyncValidation on the form field. Assigns validationmessages from the returned response\n setAsyncValidators(validators: any) {\n this._asyncValidatorFn = () => {\n return Promise.all(this.getPromiseList(validators)).then(() => {\n return null;\n }, err => {\n let validationMsg: string;\n // if err obj has validationMessage key, then set validationMessage using this value\n // else return the value of the first key in the err object as validation message.\n if (err.hasOwnProperty('errorMessage')) {\n validationMsg = get(err, 'errorMessage');\n } else {\n const messageKeys = keys(err);\n validationMsg = (err[messageKeys[0]]).toString();\n }\n this.setInvalidState(validationMsg);\n return err;\n })\n };\n }\n\n // sets the default validation on the form field\n setValidators(validators: any) {\n let _cloneValidators = cloneDeep(validators);\n this._syncValidators = [];\n forEach(_cloneValidators, (obj, index) => {\n // custom validation is bound to function.\n if (obj && obj instanceof Function) {\n // passing formwidget and form as arguments to the obj (i.e. validator function)\n _cloneValidators[index] = obj.bind(undefined, this.formwidget.proxy, this.form);\n this._syncValidators.push(_cloneValidators[index]);\n } else {\n // checks for default validator like required, maxchars etc.\n const key = get(obj, 'type');\n this.defaultValidatorMessages[key] = get(obj, 'errorMessage');\n const value = get(obj, 'validator');\n let propsObj: any = {\n props: {}\n };\n propsObj.props[key] = value;\n key === 'required' && this.updateState(propsObj as WmFormFieldState);\n this.formwidget.updateState(propsObj as WmFormFieldState);\n }\n });\n }\n\n setInvalidState(msg: string) {\n this.updateState({\n isValid: false,\n props: {\n validationmessage: msg\n }\n } as WmFormFieldState)\n this.formwidget.updateState({\n isValid: false,\n props: {\n validationmessage: msg\n }\n } as WmFormFieldState);\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'datavalue':\n if (!isEqual($old, $new)) {\n PERFORMANCE_LOGGER.debug(`form field ${this.props.name} changed from ${$old} to ${$new}`);\n }\n break;\n case 'defaultvalue':\n if (!isEqual($old, $new)) {\n get(this, 'form') && this.form.applyDefaultValue(this);\n }\n break;\n }\n }\n\n validateFormField() {\n if (this.formwidget?.state.isValid === false) {\n const errorType = this.formwidget?.state?.errorType;\n let validationMsg = get(this.defaultValidatorMessages, errorType);\n if (validationMsg) {\n if (validationMsg instanceof Function) {\n // passing formwidget and form as arguments to the errorMessage function.\n validationMsg = validationMsg(this.formwidget.proxy, this.form);\n }\n this.updateState({ props: {\n validationmessage: validationMsg\n }} as WmFormFieldState);\n }\n this.updateState({ isValid: false} as WmFormFieldState);\n } else {\n this.updateState({ isValid: true } as WmFormFieldState);\n }\n\n this._syncValidators?.forEach((fn: any) => {\n const errormsg = fn();\n let validationMsg = errormsg?.errorMessage;\n if (validationMsg) {\n if (validationMsg instanceof Function) {\n // passing formwidget and form as arguments to the errorMessage function.\n validationMsg = validationMsg(this.formwidget.proxy, this.form);\n }\n this.setInvalidState(validationMsg);\n }\n })\n\n this._asyncValidatorFn && this._asyncValidatorFn();\n\n }\n\n renderWidget(props: WmFormFieldProps) {\n var childrenWithProps = React.Children.map(props.renderFormFields(this.proxy).props.children, (child) => {\n return React.cloneElement(child, {\n datavalue: props.datavalue,\n isValid: this.state.isValid,\n invokeEvent: this.invokeEventCallback.bind(this),\n triggerValidation: this.validateFormField.bind(this),\n onFieldChange: this.onFieldChangeEvt.bind(this),\n formRef: props.formRef });\n });\n return (\n <View style={this.styles.root}>{this._background}{childrenWithProps}\n {this.state.isValid === false && <Text style={this.styles.errorMsg}>{props.validationmessage}</Text>}\n </View>\n );\n }\n}\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAQC,IAAI,EAAEC,IAAI,QAAO,cAAc;AACvC,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AAEjG,SAASC,OAAO,EAAEC,GAAG,EAAEC,IAAI,EAAEC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAAQ,QAAQ;AAErE,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,SAASC,aAAa,QAA2B,qBAAqB;AACtE,SAAQC,kBAAkB,QAAO,uCAAuC;AAExE,OAAO,MAAMC,gBAAgB,SAASV,kBAAkB,CAAmB;EAAAW,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA,kBAC/D,IAAI;EAAA;AAChB;AAEA,eAAe,MAAMC,WAAW,SAASf,aAAa,CAAwD;EAO5GY,WAAWA,CAACI,KAAuB,EAAE;IACnC,KAAK,CAACA,KAAK,EAAEP,aAAa,EAAE,IAAID,gBAAgB,CAAC,CAAC,EAAE,IAAIG,gBAAgB,CAAC,CAAC,CAAC;IAACG,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;QAChD2C,iBAAiB,EAAE,IAAI,CAACrE,iBAAiB,CAAC0B,IAAI,CAAC,IAAI,CAAC;QACpD4C,aAAa,EAAE,IAAI,CAAC5E,gBAAgB,CAACgC,IAAI,CAAC,IAAI,CAAC;QAC/C6C,OAAO,EAAE9E,KAAK,CAAC8E;MAAQ,CAAC,CAAC;IAC/B,CAAC,CAAC;IACF,oBACEjG,KAAA,CAAAkG,aAAA,CAAChG,IAAI;MAACiG,KAAK,EAAE,IAAI,CAACC,MAAM,CAACC;IAAK,GAAE,IAAI,CAACC,WAAW,EAAEf,iBAAiB,EAChE,IAAI,CAACN,KAAK,CAACP,OAAO,KAAK,KAAK,iBAAI1E,KAAA,CAAAkG,aAAA,CAACjG,IAAI;MAACkG,KAAK,EAAE,IAAI,CAACC,MAAM,CAACG;IAAS,GAAEpF,KAAK,CAACwD,iBAAwB,CAC/F,CAAC;EAEX;AACF"}
|
|
1
|
+
{"version":3,"names":["React","Text","View","BaseComponent","BaseComponentState","isEqual","get","find","cloneDeep","forEach","keys","WmFormFieldProps","DEFAULT_CLASS","PERFORMANCE_LOGGER","WmFormFieldState","constructor","arguments","_defineProperty","WmFormField","props","onFieldChangeEvt","name","$new","$old","isDefault","notifyChanges","validateFormField","updateState","datavalue","invokeEventCallback","undefined","form","updateDataOutput","call","observeOn","fields","field","formfield","formFields","f","proxy","notifyForFields","push","formwidget","validate","setTimeout","getPromiseList","validators","arr","fn","promise","Function","bind","Promise","setAsyncValidators","_asyncValidatorFn","all","then","err","validationMsg","hasOwnProperty","messageKeys","toString","setInvalidState","setValidators","_cloneValidators","_syncValidators","obj","index","key","defaultValidatorMessages","value","propsObj","updateFormWidgetDataset","res","displayField","dataset","data","datafield","displayfield","state","msg","isValid","validationmessage","onPropertyChange","debug","applyDefaultValue","setPrimaryKey","setReadOnlyState","updateMode","readonly","_this$formwidget","_this$_syncValidators","_this$formwidget2","errorType","errormsg","errorMessage","renderWidget","childrenWithProps","Children","map","renderFormFields","children","child","cloneElement","invokeEvent","triggerValidation","onFieldChange","formRef","createElement","style","styles","root","_background","errorMsg"],"sources":["form-field.component.tsx"],"sourcesContent":["import React from 'react';\nimport {Text, View} from 'react-native';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { widgetsWithUndefinedValue } from '@wavemaker/app-rn-runtime/core/utils';\nimport { isEqual, get, find, cloneDeep, forEach, keys } from 'lodash';\n\nimport WmFormFieldProps from './form-field.props';\nimport { DEFAULT_CLASS, WmFormFieldStyles } from './form-field.styles';\nimport {PERFORMANCE_LOGGER} from \"@wavemaker/app-rn-runtime/core/logger\";\n\nexport class WmFormFieldState extends BaseComponentState<WmFormFieldProps> {\n isValid = true;\n}\n\nexport default class WmFormField extends BaseComponent<WmFormFieldProps, WmFormFieldState, WmFormFieldStyles> {\n public form: any;\n public formwidget: any;\n public _syncValidators: any;\n public defaultValidatorMessages: any = [];\n private notifyForFields: any = [];\n private _asyncValidatorFn: any;\n constructor(props: WmFormFieldProps) {\n super(props, DEFAULT_CLASS, new WmFormFieldProps(), new WmFormFieldState());\n }\n\n onFieldChangeEvt(name: string, $new: any, $old: any, isDefault: boolean) {\n this.notifyChanges();\n this.validateFormField();\n if (!isEqual($old, $new)) {\n this.updateState({ props: { datavalue: $new }} as WmFormFieldState, () => {\n !isDefault && this.invokeEventCallback('onChange', [undefined, this, $new, $old]);\n });\n if (this.form) {\n this.form.updateDataOutput.call(this.form, get(this.props, 'formKey', this.props.name), $new);\n }\n }\n }\n\n // Registers observer of validation fields\n observeOn(fields: any) {\n forEach(fields, (field) => {\n const formfield = find(this.form.formFields, (f) => f.proxy.name === field);\n if (formfield) {\n formfield.notifyForFields.push(this);\n }\n });\n }\n\n // Notifies changes to observing validation fields\n notifyChanges() {\n forEach(this.notifyForFields, (field) => {\n field.formwidget.validate(field.formwidget.datavalue);\n setTimeout(() => field.validateFormField());\n });\n }\n\n getPromiseList(validators: any) {\n const arr: any = [];\n forEach(validators, (fn) => {\n let promise = fn;\n if (fn instanceof Function && fn.bind) {\n promise = fn(this.formwidget.proxy, this.form);\n }\n if (promise instanceof Promise) {\n arr.push(promise);\n }\n });\n return arr;\n }\n\n // this method sets the asyncValidation on the form field. Assigns validationmessages from the returned response\n setAsyncValidators(validators: any) {\n this._asyncValidatorFn = () => {\n return Promise.all(this.getPromiseList(validators)).then(() => {\n return null;\n }, err => {\n let validationMsg: string;\n // if err obj has validationMessage key, then set validationMessage using this value\n // else return the value of the first key in the err object as validation message.\n if (err.hasOwnProperty('errorMessage')) {\n validationMsg = get(err, 'errorMessage');\n } else {\n const messageKeys = keys(err);\n validationMsg = (err[messageKeys[0]]).toString();\n }\n this.setInvalidState(validationMsg);\n return err;\n })\n };\n }\n\n // sets the default validation on the form field\n setValidators(validators: any) {\n let _cloneValidators = cloneDeep(validators);\n this._syncValidators = [];\n forEach(_cloneValidators, (obj, index) => {\n // custom validation is bound to function.\n if (obj && obj instanceof Function) {\n // passing formwidget and form as arguments to the obj (i.e. validator function)\n _cloneValidators[index] = obj.bind(undefined, this.formwidget.proxy, this.form);\n this._syncValidators.push(_cloneValidators[index]);\n } else {\n // checks for default validator like required, maxchars etc.\n const key = get(obj, 'type');\n this.defaultValidatorMessages[key] = get(obj, 'errorMessage');\n const value = get(obj, 'validator');\n let propsObj: any = {\n props: {}\n };\n propsObj.props[key] = value;\n key === 'required' && this.updateState(propsObj as WmFormFieldState);\n this.formwidget.updateState(propsObj as WmFormFieldState);\n }\n });\n }\n\n updateFormWidgetDataset(res: any, displayField: string) {\n this.formwidget.updateState({\n props: {\n dataset: res.data,\n datafield: 'All Fields',\n displayfield: this.formwidget.state.props.displayfield || displayField,\n }\n } as WmFormFieldState);\n }\n\n setInvalidState(msg: string) {\n this.updateState({\n isValid: false,\n props: {\n validationmessage: msg\n }\n } as WmFormFieldState)\n this.formwidget.updateState({\n isValid: false,\n props: {\n validationmessage: msg\n }\n } as WmFormFieldState);\n }\n\n onPropertyChange(name: string, $new: any, $old: any) {\n switch (name) {\n case 'datavalue':\n if (!isEqual($old, $new)) {\n PERFORMANCE_LOGGER.debug(`form field ${this.props.name} changed from ${$old} to ${$new}`);\n }\n break;\n case 'defaultvalue':\n if (!isEqual($old, $new)) {\n get(this, 'form') && this.form.applyDefaultValue(this);\n }\n break;\n case 'primary-key':\n if ($new) {\n this.form.setPrimaryKey(this.props.name);\n }\n break;\n }\n }\n\n setReadOnlyState(updateMode: any) {\n this.formwidget.updateState({\n props: {\n readonly: !updateMode,\n }\n } as WmFormFieldState);\n }\n\n validateFormField() {\n if (this.formwidget?.state.isValid === false) {\n const errorType = this.formwidget?.state?.errorType;\n let validationMsg = get(this.defaultValidatorMessages, errorType);\n if (validationMsg) {\n if (validationMsg instanceof Function) {\n // passing formwidget and form as arguments to the errorMessage function.\n validationMsg = validationMsg(this.formwidget.proxy, this.form);\n }\n this.updateState({ props: {\n validationmessage: validationMsg\n }} as WmFormFieldState);\n }\n this.updateState({ isValid: false} as WmFormFieldState);\n } else {\n this.updateState({ isValid: true } as WmFormFieldState);\n }\n\n this._syncValidators?.forEach((fn: any) => {\n const errormsg = fn();\n let validationMsg = errormsg?.errorMessage;\n if (validationMsg) {\n if (validationMsg instanceof Function) {\n // passing formwidget and form as arguments to the errorMessage function.\n validationMsg = validationMsg(this.formwidget.proxy, this.form);\n }\n this.setInvalidState(validationMsg);\n }\n })\n\n this._asyncValidatorFn && this._asyncValidatorFn();\n\n }\n\n renderWidget(props: WmFormFieldProps) {\n var childrenWithProps = React.Children.map(props.renderFormFields(this.proxy).props.children, (child) => {\n return React.cloneElement(child, {\n datavalue: props.datavalue,\n isValid: this.state.isValid,\n invokeEvent: this.invokeEventCallback.bind(this),\n triggerValidation: this.validateFormField.bind(this),\n onFieldChange: this.onFieldChangeEvt.bind(this),\n formRef: props.formRef });\n });\n return (\n <View style={this.styles.root}>{this._background}{childrenWithProps}\n {this.state.isValid === false && <Text style={this.styles.errorMsg}>{props.validationmessage}</Text>}\n </View>\n );\n }\n}\n"],"mappings":";;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AAI,CAAC;QAChDsD,iBAAiB,EAAE,IAAI,CAAChF,iBAAiB,CAAC0B,IAAI,CAAC,IAAI,CAAC;QACpDuD,aAAa,EAAE,IAAI,CAACvF,gBAAgB,CAACgC,IAAI,CAAC,IAAI,CAAC;QAC/CwD,OAAO,EAAEzF,KAAK,CAACyF;MAAQ,CAAC,CAAC;IAC/B,CAAC,CAAC;IACF,oBACE5G,KAAA,CAAA6G,aAAA,CAAC3G,IAAI;MAAC4G,KAAK,EAAE,IAAI,CAACC,MAAM,CAACC;IAAK,GAAE,IAAI,CAACC,WAAW,EAAEf,iBAAiB,EAChE,IAAI,CAAClB,KAAK,CAACE,OAAO,KAAK,KAAK,iBAAIlF,KAAA,CAAA6G,aAAA,CAAC5G,IAAI;MAAC6G,KAAK,EAAE,IAAI,CAACC,MAAM,CAACG;IAAS,GAAE/F,KAAK,CAACgE,iBAAwB,CAC/F,CAAC;EAEX;AACF"}
|
|
@@ -8,14 +8,22 @@ export default class WmFormFieldProps extends BaseProps {
|
|
|
8
8
|
_defineProperty(this, "children", void 0);
|
|
9
9
|
_defineProperty(this, "formRef", void 0);
|
|
10
10
|
_defineProperty(this, "defaultvalue", void 0);
|
|
11
|
+
_defineProperty(this, "generator", '');
|
|
11
12
|
_defineProperty(this, "datavalue", void 0);
|
|
12
13
|
_defineProperty(this, "onChange", void 0);
|
|
13
14
|
_defineProperty(this, "renderFormFields", void 0);
|
|
14
15
|
_defineProperty(this, "validationmessage", void 0);
|
|
15
16
|
_defineProperty(this, "required", false);
|
|
17
|
+
_defineProperty(this, "primaryKey", false);
|
|
18
|
+
_defineProperty(this, "isRelated", void 0);
|
|
16
19
|
_defineProperty(this, "widget", void 0);
|
|
17
20
|
_defineProperty(this, "onFieldChange", void 0);
|
|
18
21
|
_defineProperty(this, "formKey", '');
|
|
22
|
+
_defineProperty(this, "dataset", void 0);
|
|
23
|
+
_defineProperty(this, "displayfield", void 0);
|
|
24
|
+
_defineProperty(this, "datafield", '');
|
|
25
|
+
_defineProperty(this, "isDataSetBound", false);
|
|
26
|
+
_defineProperty(this, "readonly", false);
|
|
19
27
|
_defineProperty(this, "onValidate", void 0);
|
|
20
28
|
}
|
|
21
29
|
}
|