@wavemaker/app-rn-runtime 11.4.2-rc.5389 → 11.4.2-rc.5398
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/basic/label/label.component.js +2 -1
- app-rn-runtime/components/basic/label/label.component.js.map +1 -1
- app-rn-runtime/components/basic/label/label.props.js +1 -0
- app-rn-runtime/components/basic/label/label.props.js.map +1 -1
- app-rn-runtime/components/chart/area-chart/area-chart.component.js +15 -10
- app-rn-runtime/components/chart/area-chart/area-chart.component.js.map +1 -1
- app-rn-runtime/components/chart/area-chart/area-chart.props.js +9 -1
- app-rn-runtime/components/chart/area-chart/area-chart.props.js.map +1 -1
- app-rn-runtime/components/chart/basechart.component.js +82 -39
- app-rn-runtime/components/chart/basechart.component.js.map +1 -1
- app-rn-runtime/components/chart/basechart.props.js +8 -3
- app-rn-runtime/components/chart/basechart.props.js.map +1 -1
- app-rn-runtime/components/chart/basechart.styles.js +25 -1
- app-rn-runtime/components/chart/basechart.styles.js.map +1 -1
- app-rn-runtime/components/chart/line-chart/line-chart.component.js +31 -6
- app-rn-runtime/components/chart/line-chart/line-chart.component.js.map +1 -1
- app-rn-runtime/components/chart/line-chart/line-chart.props.js +1 -0
- app-rn-runtime/components/chart/line-chart/line-chart.props.js.map +1 -1
- app-rn-runtime/components/chart/pie-chart/pie-chart.component.js +23 -2
- 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 -0
- app-rn-runtime/components/chart/pie-chart/pie-chart.props.js.map +1 -1
- app-rn-runtime/components/container/wizard/wizard.component.js +93 -2
- app-rn-runtime/components/container/wizard/wizard.component.js.map +1 -1
- app-rn-runtime/components/container/wizard/wizard.props.js +4 -0
- app-rn-runtime/components/container/wizard/wizard.props.js.map +1 -1
- app-rn-runtime/components/container/wizard/wizard.styles.js +103 -2
- app-rn-runtime/components/container/wizard/wizard.styles.js.map +1 -1
- app-rn-runtime/components/container/wizard/wizardstep/wizardstep.props.js +1 -0
- app-rn-runtime/components/container/wizard/wizardstep/wizardstep.props.js.map +1 -1
- app-rn-runtime/components/input/basenumber/basenumber.component.js +39 -5
- app-rn-runtime/components/input/basenumber/basenumber.component.js.map +1 -1
- app-rn-runtime/components/input/basenumber/basenumber.props.js +1 -0
- app-rn-runtime/components/input/basenumber/basenumber.props.js.map +1 -1
- app-rn-runtime/components/input/currency/currency.component.js +4 -1
- app-rn-runtime/components/input/currency/currency.component.js.map +1 -1
- app-rn-runtime/components/input/number/number.component.js +4 -1
- app-rn-runtime/components/input/number/number.component.js.map +1 -1
- app-rn-runtime/core/constant.service.js +22 -0
- app-rn-runtime/core/constant.service.js.map +1 -0
- app-rn-runtime/core/formatters.js +9 -2
- app-rn-runtime/core/formatters.js.map +1 -1
- app-rn-runtime/core/tappable.component.js +5 -2
- app-rn-runtime/core/tappable.component.js.map +1 -1
- app-rn-runtime/core/utils.js +16 -0
- app-rn-runtime/core/utils.js.map +1 -1
- app-rn-runtime/package.json +3 -3
- app-rn-runtime/runtime/App.js +16 -0
- app-rn-runtime/runtime/App.js.map +1 -1
|
@@ -57,7 +57,8 @@ export default class WmLabel extends BaseComponent {
|
|
|
57
57
|
style: [this.styles.text, {
|
|
58
58
|
color: props.isValid === false ? 'red' : this.styles.text.color
|
|
59
59
|
}],
|
|
60
|
-
|
|
60
|
+
ellipsizeMode: "tail",
|
|
61
|
+
numberOfLines: props.wrap ? undefined : props.nooflines,
|
|
61
62
|
selectable: this.styles.text.userSelect === 'text'
|
|
62
63
|
}, toString(props.caption), props.required && this.getAsterisk()))) : null;
|
|
63
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Text","View","BaseComponent","BaseComponentState","Tappable","WmLabelProps","DEFAULT_CLASS","isNil","toString","Animatedview","createSkeleton","WmLabelState","WmLabel","constructor","props","getAsterisk","createElement","style","styles","asterisk","getMultilineSkeleton","width","height","borderRadius","marginBottom","theme","skeleton","renderSkeleton","_this$styles$root","_this$styles$root2","skeletonWidth","skeletonwidth","root","skeletonHeight","skeletonheight","text","fontSize","multilineskeleton","renderWidget","caption","entryanimation","animation","_background","target","color","isValid","numberOfLines","wrap","undefined","selectable","userSelect","required"],"sources":["label.component.tsx"],"sourcesContent":["import React from 'react';\nimport { DimensionValue, Text, View } from 'react-native';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { Tappable } from '@wavemaker/app-rn-runtime/core/tappable.component';\n\nimport WmLabelProps from './label.props';\nimport { DEFAULT_CLASS, WmLabelStyles } from './label.styles';\nimport { isNil, toString } from 'lodash-es';\nimport { Animatedview } from '@wavemaker/app-rn-runtime/components/basic/animatedview.component';\nimport WmSkeleton, { createSkeleton } from '../skeleton/skeleton.component';\nimport { totalMonths } from 'react-native-paper-dates/lib/typescript/Date/dateUtils';\n\nexport class WmLabelState extends BaseComponentState<WmLabelProps> {\n\n}\n\nexport default class WmLabel extends BaseComponent<WmLabelProps, WmLabelState, WmLabelStyles> {\n\n constructor(props: WmLabelProps) {\n super(props, DEFAULT_CLASS, new WmLabelProps());\n }\n\n private getAsterisk () {\n return <Text style={this.styles.asterisk}>*</Text>;\n }\n\n private getMultilineSkeleton(width: any, height: any) {\n const styles = {\n borderRadius:4,\n marginBottom: 10,\n height: height\n };\n return createSkeleton(this.theme, this.styles.skeleton, {\n ...styles,\n width: width,\n height: height\n });\n }\n\n public renderSkeleton(props: WmLabelProps){\n const skeletonWidth = this.props.skeletonwidth || this.styles.root?.width;\n const skeletonHeight = this.props.skeletonheight || this.styles.root?.height || this.styles.text.fontSize;\n if(this.props.multilineskeleton) {\n return (<View style={{\n width: skeletonWidth as DimensionValue\n }}>\n {this.getMultilineSkeleton('100%', skeletonHeight)}\n {this.getMultilineSkeleton('70%', skeletonHeight)}\n {this.getMultilineSkeleton('40%', skeletonHeight)}\n </View>)\n }\n else{\n return createSkeleton(this.theme, this.styles.skeleton, {\n ...this.styles.root,\n width: skeletonWidth as DimensionValue,\n height: skeletonHeight as DimensionValue\n }); \n }\n }\n\n renderWidget(props: WmLabelProps) {\n return !isNil(props.caption)? (\n <Animatedview entryanimation={props.animation} style={this.styles.root}>\n {this._background}\n <Tappable target={this}>\n <Text\n style={[this.styles.text, \n {color: props.isValid === false ? 'red' : this.styles.text.color}]}\n numberOfLines={props.wrap ? undefined :
|
|
1
|
+
{"version":3,"names":["React","Text","View","BaseComponent","BaseComponentState","Tappable","WmLabelProps","DEFAULT_CLASS","isNil","toString","Animatedview","createSkeleton","WmLabelState","WmLabel","constructor","props","getAsterisk","createElement","style","styles","asterisk","getMultilineSkeleton","width","height","borderRadius","marginBottom","theme","skeleton","renderSkeleton","_this$styles$root","_this$styles$root2","skeletonWidth","skeletonwidth","root","skeletonHeight","skeletonheight","text","fontSize","multilineskeleton","renderWidget","caption","entryanimation","animation","_background","target","color","isValid","ellipsizeMode","numberOfLines","wrap","undefined","nooflines","selectable","userSelect","required"],"sources":["label.component.tsx"],"sourcesContent":["import React from 'react';\nimport { DimensionValue, Text, View } from 'react-native';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { Tappable } from '@wavemaker/app-rn-runtime/core/tappable.component';\n\nimport WmLabelProps from './label.props';\nimport { DEFAULT_CLASS, WmLabelStyles } from './label.styles';\nimport { isNil, toString } from 'lodash-es';\nimport { Animatedview } from '@wavemaker/app-rn-runtime/components/basic/animatedview.component';\nimport WmSkeleton, { createSkeleton } from '../skeleton/skeleton.component';\nimport { totalMonths } from 'react-native-paper-dates/lib/typescript/Date/dateUtils';\n\nexport class WmLabelState extends BaseComponentState<WmLabelProps> {\n\n}\n\nexport default class WmLabel extends BaseComponent<WmLabelProps, WmLabelState, WmLabelStyles> {\n\n constructor(props: WmLabelProps) {\n super(props, DEFAULT_CLASS, new WmLabelProps());\n }\n\n private getAsterisk () {\n return <Text style={this.styles.asterisk}>*</Text>;\n }\n\n private getMultilineSkeleton(width: any, height: any) {\n const styles = {\n borderRadius:4,\n marginBottom: 10,\n height: height\n };\n return createSkeleton(this.theme, this.styles.skeleton, {\n ...styles,\n width: width,\n height: height\n });\n }\n\n public renderSkeleton(props: WmLabelProps){\n const skeletonWidth = this.props.skeletonwidth || this.styles.root?.width;\n const skeletonHeight = this.props.skeletonheight || this.styles.root?.height || this.styles.text.fontSize;\n if(this.props.multilineskeleton) {\n return (<View style={{\n width: skeletonWidth as DimensionValue\n }}>\n {this.getMultilineSkeleton('100%', skeletonHeight)}\n {this.getMultilineSkeleton('70%', skeletonHeight)}\n {this.getMultilineSkeleton('40%', skeletonHeight)}\n </View>)\n }\n else{\n return createSkeleton(this.theme, this.styles.skeleton, {\n ...this.styles.root,\n width: skeletonWidth as DimensionValue,\n height: skeletonHeight as DimensionValue\n }); \n }\n }\n\n renderWidget(props: WmLabelProps) {\n return !isNil(props.caption)? (\n <Animatedview entryanimation={props.animation} style={this.styles.root}>\n {this._background}\n <Tappable target={this}>\n <Text\n style={[this.styles.text, \n {color: props.isValid === false ? 'red' : this.styles.text.color}]}\n ellipsizeMode=\"tail\"\n numberOfLines={props.wrap ? undefined : props.nooflines}\n selectable={this.styles.text.userSelect === 'text'}>\n {toString(props.caption)}\n {props.required && this.getAsterisk()}\n </Text>\n </Tappable>\n </Animatedview>\n ): null;\n }\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAyBC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AACzD,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AACjG,SAASC,QAAQ,QAAQ,mDAAmD;AAE5E,OAAOC,YAAY,MAAM,eAAe;AACxC,SAASC,aAAa,QAAuB,gBAAgB;AAC7D,SAASC,KAAK,EAAEC,QAAQ,QAAQ,WAAW;AAC3C,SAASC,YAAY,QAAQ,mEAAmE;AAChG,SAAqBC,cAAc,QAAQ,gCAAgC;AAG3E,OAAO,MAAMC,YAAY,SAASR,kBAAkB,CAA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CAChC,CACA,CACE,CAAC,GACd,IAAI;EACT;AACF"}
|
|
@@ -13,6 +13,7 @@ export default class WmLabelProps extends BaseProps {
|
|
|
13
13
|
_defineProperty(this, "skeletonheight", null);
|
|
14
14
|
_defineProperty(this, "skeletonwidth", null);
|
|
15
15
|
_defineProperty(this, "multilineskeleton", false);
|
|
16
|
+
_defineProperty(this, "nooflines", 1);
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
//# sourceMappingURL=label.props.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BaseProps","WmLabelProps","constructor","arguments","_defineProperty"],"sources":["label.props.ts"],"sourcesContent":["import { BaseProps } from '@wavemaker/app-rn-runtime/core/base.component';\n\nexport default class WmLabelProps extends BaseProps {\n animation?: string = null as any;\n caption?: string = 'Label';\n required?: boolean = null as any;\n isValid?: boolean = true;\n wrap?: boolean = true;\n skeletonheight?: string = null as any;\n skeletonwidth?: string = null as any;\n multilineskeleton?: boolean = false;\n}\n"],"mappings":";;;AAAA,SAASA,SAAS,QAAQ,+CAA+C;AAEzE,eAAe,MAAMC,YAAY,SAASD,SAAS,CAAC;EAAAE,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA,oBAC3B,IAAI;IAAAA,eAAA,kBACN,OAAO;IAAAA,eAAA,mBACL,IAAI;IAAAA,eAAA,kBACL,IAAI;IAAAA,eAAA,eACP,IAAI;IAAAA,eAAA,yBACK,IAAI;IAAAA,eAAA,wBACL,IAAI;IAAAA,eAAA,4BACC,KAAK;EAAA;
|
|
1
|
+
{"version":3,"names":["BaseProps","WmLabelProps","constructor","arguments","_defineProperty"],"sources":["label.props.ts"],"sourcesContent":["import { BaseProps } from '@wavemaker/app-rn-runtime/core/base.component';\n\nexport default class WmLabelProps extends BaseProps {\n animation?: string = null as any;\n caption?: string = 'Label';\n required?: boolean = null as any;\n isValid?: boolean = true;\n wrap?: boolean = true;\n skeletonheight?: string = null as any;\n skeletonwidth?: string = null as any;\n multilineskeleton?: boolean = false;\n nooflines? = 1;\n}\n"],"mappings":";;;AAAA,SAASA,SAAS,QAAQ,+CAA+C;AAEzE,eAAe,MAAMC,YAAY,SAASD,SAAS,CAAC;EAAAE,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA,oBAC3B,IAAI;IAAAA,eAAA,kBACN,OAAO;IAAAA,eAAA,mBACL,IAAI;IAAAA,eAAA,kBACL,IAAI;IAAAA,eAAA,eACP,IAAI;IAAAA,eAAA,yBACK,IAAI;IAAAA,eAAA,wBACL,IAAI;IAAAA,eAAA,4BACC,KAAK;IAAAA,eAAA,oBACtB,CAAC;EAAA;AAClB"}
|
|
@@ -2,12 +2,14 @@ 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 Color from "color";
|
|
5
6
|
import { View } from 'react-native';
|
|
6
7
|
import { Defs, LinearGradient, Stop, Svg } from 'react-native-svg';
|
|
7
8
|
import { VictoryArea, VictoryChart, VictoryLegend, VictoryStack, VictoryScatter, VictoryGroup } from "victory-native";
|
|
8
9
|
import WmAreaChartProps from './area-chart.props';
|
|
9
10
|
import { DEFAULT_CLASS } from './area-chart.styles';
|
|
10
11
|
import { BaseChartComponent, BaseChartComponentState } from "@wavemaker/app-rn-runtime/components/chart/basechart.component";
|
|
12
|
+
import { isNumber } from 'lodash-es';
|
|
11
13
|
export class WmAreaChartState extends BaseChartComponentState {
|
|
12
14
|
constructor() {
|
|
13
15
|
super(...arguments);
|
|
@@ -30,10 +32,14 @@ export default class WmAreaChart extends BaseChartComponent {
|
|
|
30
32
|
return null;
|
|
31
33
|
}
|
|
32
34
|
let mindomain = {
|
|
33
|
-
x:
|
|
34
|
-
y:
|
|
35
|
+
x: props.xdomain === 'Min' ? this.state.chartMinX : undefined,
|
|
36
|
+
y: props.ydomain === 'Min' ? this.state.chartMinY : undefined
|
|
35
37
|
};
|
|
36
38
|
const chartName = this.props.name ?? 'nonameAreachart';
|
|
39
|
+
let gradientStop = '100%';
|
|
40
|
+
if (isNumber(this.state.chartMaxY) && isNumber(this.state.chartMinY) && this.state.chartMaxY > 0) {
|
|
41
|
+
gradientStop = (this.state.chartMaxY - this.state.chartMinY) * 100 / this.state.chartMaxY + '%';
|
|
42
|
+
}
|
|
37
43
|
return /*#__PURE__*/React.createElement(View, {
|
|
38
44
|
style: this.styles.root,
|
|
39
45
|
onLayout: this.onViewLayoutChange.bind(this)
|
|
@@ -45,7 +51,7 @@ export default class WmAreaChart extends BaseChartComponent {
|
|
|
45
51
|
top: 70,
|
|
46
52
|
bottom: 50,
|
|
47
53
|
left: 50,
|
|
48
|
-
right:
|
|
54
|
+
right: 30
|
|
49
55
|
},
|
|
50
56
|
minDomain: mindomain
|
|
51
57
|
}, /*#__PURE__*/React.createElement(VictoryLegend, {
|
|
@@ -67,18 +73,18 @@ export default class WmAreaChart extends BaseChartComponent {
|
|
|
67
73
|
y2: "100%"
|
|
68
74
|
}, /*#__PURE__*/React.createElement(Stop, {
|
|
69
75
|
offset: "0%",
|
|
70
|
-
stopColor: this.state.colors[i]
|
|
76
|
+
stopColor: Color(this.state.colors[i]).lighten(0.2).rgb().toString()
|
|
71
77
|
}), /*#__PURE__*/React.createElement(Stop, {
|
|
72
|
-
offset:
|
|
73
|
-
stopColor:
|
|
74
|
-
stopOpacity: "0"
|
|
78
|
+
offset: gradientStop,
|
|
79
|
+
stopColor: Color(this.state.colors[i]).lighten(0.6).rgb().toString()
|
|
75
80
|
}))), /*#__PURE__*/React.createElement(VictoryArea, {
|
|
76
81
|
interpolation: props.interpolation,
|
|
77
82
|
key: props.name + '_' + i,
|
|
78
83
|
style: {
|
|
79
84
|
data: {
|
|
80
85
|
fill: `url(#${chartName}Gradient${i})`,
|
|
81
|
-
stroke: this.state.colors[i]
|
|
86
|
+
stroke: this.state.colors[i],
|
|
87
|
+
strokeWidth: props.linethickness
|
|
82
88
|
}
|
|
83
89
|
},
|
|
84
90
|
data: d
|
|
@@ -87,8 +93,7 @@ export default class WmAreaChart extends BaseChartComponent {
|
|
|
87
93
|
key: props.name + '_scatter' + i,
|
|
88
94
|
style: {
|
|
89
95
|
data: {
|
|
90
|
-
fill: this.state.colors[i]
|
|
91
|
-
opacity: 0.8
|
|
96
|
+
fill: Color(this.state.colors[i]).darken(0.2).rgb().toString()
|
|
92
97
|
}
|
|
93
98
|
},
|
|
94
99
|
data: d
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","Defs","LinearGradient","Stop","Svg","VictoryArea","VictoryChart","VictoryLegend","VictoryStack","VictoryScatter","VictoryGroup","WmAreaChartProps","DEFAULT_CLASS","BaseChartComponent","BaseChartComponentState","WmAreaChartState","constructor","arguments","_defineProperty","WmAreaChart","props","e","viewWidth","nativeEvent","layout","width","updateState","chartWidth","renderWidget","_this$state$data","state","data","length","mindomain","x","xdomain","chartMinX","undefined","y","ydomain","chartMinY","chartName","name","createElement","style","styles","root","onLayout","onViewLayoutChange","bind","theme","height","padding","top","bottom","left","right","minDomain","containerComponent","title","subheading","orientation","gutter","getLegendView","getXaxis","getYAxis","map","d","i","key","id","x1","y1","x2","y2","offset","stopColor","colors","
|
|
1
|
+
{"version":3,"names":["React","Color","View","Defs","LinearGradient","Stop","Svg","VictoryArea","VictoryChart","VictoryLegend","VictoryStack","VictoryScatter","VictoryGroup","WmAreaChartProps","DEFAULT_CLASS","BaseChartComponent","BaseChartComponentState","isNumber","WmAreaChartState","constructor","arguments","_defineProperty","WmAreaChart","props","e","viewWidth","nativeEvent","layout","width","updateState","chartWidth","renderWidget","_this$state$data","state","data","length","mindomain","x","xdomain","chartMinX","undefined","y","ydomain","chartMinY","chartName","name","gradientStop","chartMaxY","createElement","style","styles","root","onLayout","onViewLayoutChange","bind","theme","height","padding","top","bottom","left","right","minDomain","containerComponent","title","subheading","orientation","gutter","getLegendView","getXaxis","getYAxis","map","d","i","key","id","x1","y1","x2","y2","offset","stopColor","colors","lighten","rgb","toString","interpolation","fill","stroke","strokeWidth","linethickness","highlightpoints","size","darken"],"sources":["area-chart.component.tsx"],"sourcesContent":["import React from 'react';\nimport Color from \"color\";\nimport { LayoutChangeEvent, View, Text } from 'react-native';\nimport { Defs, LinearGradient, Stop, Svg } from 'react-native-svg';\nimport { VictoryArea, VictoryLine, VictoryChart, VictoryLegend, VictoryStack, VictoryScatter, VictoryGroup } from \"victory-native\";\nimport { InterpolationPropType } from 'victory-core';\nimport WmAreaChartProps from './area-chart.props';\nimport { DEFAULT_CLASS, WmAreaChartStyles } from './area-chart.styles';\nimport {\n BaseChartComponent,\n BaseChartComponentState\n} from \"@wavemaker/app-rn-runtime/components/chart/basechart.component\";\nimport ThemeVariables from '@wavemaker/app-rn-runtime/styles/theme.variables';\nimport { isNil, isNumber } from 'lodash-es';\n\nexport class WmAreaChartState extends BaseChartComponentState<WmAreaChartProps> {\n chartWidth = 0;\n}\n\nexport default class WmAreaChart extends BaseChartComponent<WmAreaChartProps, WmAreaChartState, WmAreaChartStyles> {\n\n constructor(props: WmAreaChartProps) {\n super(props, DEFAULT_CLASS, new WmAreaChartProps(), new WmAreaChartState());\n }\n\n onViewLayoutChange = (e: LayoutChangeEvent) => {\n let viewWidth = e.nativeEvent.layout.width;\n this.updateState({\n chartWidth: viewWidth\n } as WmAreaChartState)\n }\n\n renderWidget(props: WmAreaChartProps) {\n if (!this.state.data?.length) {\n return null;\n }\n let mindomain={\n x: props.xdomain === 'Min' ? this.state.chartMinX: undefined,\n y: props.ydomain === 'Min' ? this.state.chartMinY: undefined\n };\n const chartName = this.props.name ?? 'nonameAreachart';\n let gradientStop = '100%';\n if (isNumber(this.state.chartMaxY) && isNumber(this.state.chartMinY) && this.state.chartMaxY > 0) {\n gradientStop = (this.state.chartMaxY - this.state.chartMinY) * 100 / this.state.chartMaxY + '%';\n }\n return (\n <View\n style={this.styles.root}\n onLayout={this.onViewLayoutChange.bind(this)}\n >\n {this.state.chartWidth ? \n (\n <VictoryChart\n theme={this.state.theme}\n height={this.styles.root.height as number}\n width={this.state.chartWidth || 120}\n padding={{ top: 70, bottom: 50, left: 50, right: 30 }}\n minDomain={mindomain}\n > \n <VictoryLegend\n name={'legend'}\n containerComponent={<Svg />}\n title={[props.title, props.subheading]}\n orientation=\"horizontal\"\n gutter={20}\n data={[]}\n theme={this.state.theme}\n />\n {this.getLegendView()}\n {this.getXaxis()}\n {this.getYAxis()}\n <VictoryStack>\n {\n this.state.data.map((d: any, i: number) => {\n return <VictoryGroup key={props.name + '_area_group_' + i}>\n <Defs>\n <LinearGradient id={`${chartName}Gradient${i}`} x1=\"0%\" y1=\"0%\" x2=\"0%\" y2=\"100%\">\n <Stop offset=\"0%\" stopColor={Color(this.state.colors[i]).lighten(0.2).rgb().toString()}/>\n <Stop offset={gradientStop} stopColor={Color(this.state.colors[i]).lighten(0.6).rgb().toString()}/>\n </LinearGradient>\n </Defs>\n <VictoryArea\n interpolation={props.interpolation as InterpolationPropType}\n key={props.name + '_' + i}\n style={{\n data: {\n fill: `url(#${chartName}Gradient${i})`,\n stroke: this.state.colors[i],\n strokeWidth: props.linethickness,\n }\n }}\n data={d}\n />\n {props.highlightpoints ?\n <VictoryScatter\n size={5}\n key={props.name + '_scatter' + i}\n style={{\n data: { \n fill: Color(this.state.colors[i]).darken(0.2).rgb().toString()}\n }} \n data={d}\n />\n : null}\n </VictoryGroup>\n })\n }\n </VictoryStack>\n </VictoryChart>\n )\n : null}\n </View>);\n }\n}\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,KAAK,MAAM,OAAO;AACzB,SAA4BC,IAAI,QAAc,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AC,CAAC,CAACC,QAAQ,CAAC;MAAE,CAAC,CACpF,CACZ,CAAC,eACPrF,KAAA,CAAAgD,aAAA,CAACzC,WAAW;QACV+E,aAAa,EAAE/D,KAAK,CAAC+D,aAAuC;QAC5DZ,GAAG,EAAEnD,KAAK,CAACsB,IAAI,GAAG,GAAG,GAAG4B,CAAE;QAC1BxB,KAAK,EAAE;UACLf,IAAI,EAAE;YACJqD,IAAI,EAAG,QAAO3C,SAAU,WAAU6B,CAAE,GAAE;YACtCe,MAAM,EAAE,IAAI,CAACvD,KAAK,CAACiD,MAAM,CAACT,CAAC,CAAC;YAC5BgB,WAAW,EAAElE,KAAK,CAACmE;UACrB;QACF,CAAE;QACFxD,IAAI,EAAEsC;MAAE,CACT,CAAC,EACDjD,KAAK,CAACoE,eAAe,gBACpB3F,KAAA,CAAAgD,aAAA,CAACrC,cAAc;QACbiF,IAAI,EAAE,CAAE;QACRlB,GAAG,EAAEnD,KAAK,CAACsB,IAAI,GAAG,UAAU,GAAG4B,CAAE;QACjCxB,KAAK,EAAE;UACLf,IAAI,EAAE;YACJqD,IAAI,EAAEtF,KAAK,CAAC,IAAI,CAACgC,KAAK,CAACiD,MAAM,CAACT,CAAC,CAAC,CAAC,CAACoB,MAAM,CAAC,GAAG,CAAC,CAACT,GAAG,CAAC,CAAC,CAACC,QAAQ,CAAC;UAAC;QAClE,CAAE;QACFnD,IAAI,EAAEsC;MAAE,CACP,CAAC,GACJ,IACU,CAAC;IACjB,CAAC,CAEW,CACF,CAAC,GAEjB,IACE,CAAC;EACT;AACF"}
|
|
@@ -1,3 +1,11 @@
|
|
|
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
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
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); }
|
|
1
4
|
import BaseChartComponentProps from "@wavemaker/app-rn-runtime/components/chart/basechart.props";
|
|
2
|
-
export default class WmAreaChartProps extends BaseChartComponentProps {
|
|
5
|
+
export default class WmAreaChartProps extends BaseChartComponentProps {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
_defineProperty(this, "linethickness", 2);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
3
11
|
//# sourceMappingURL=area-chart.props.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BaseChartComponentProps","WmAreaChartProps"],"sources":["area-chart.props.ts"],"sourcesContent":["import BaseChartComponentProps from \"@wavemaker/app-rn-runtime/components/chart/basechart.props\";\n\nexport default class WmAreaChartProps extends BaseChartComponentProps {\n
|
|
1
|
+
{"version":3,"names":["BaseChartComponentProps","WmAreaChartProps","constructor","arguments","_defineProperty"],"sources":["area-chart.props.ts"],"sourcesContent":["import BaseChartComponentProps from \"@wavemaker/app-rn-runtime/components/chart/basechart.props\";\n\nexport default class WmAreaChartProps extends BaseChartComponentProps {\n linethickness: number = 2;\n}\n"],"mappings":";;;AAAA,OAAOA,uBAAuB,MAAM,4DAA4D;AAEhG,eAAe,MAAMC,gBAAgB,SAASD,uBAAuB,CAAC;EAAAE,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA,wBAC1C,CAAC;EAAA;AAC7B"}
|
|
@@ -84,12 +84,13 @@ export class BaseChartComponent extends BaseComponent {
|
|
|
84
84
|
if (this.state.props.showlegend === 'hide') {
|
|
85
85
|
return null;
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
const props = this.state.props;
|
|
88
|
+
let top = props.showlegend === 'bottom' ? parseInt(this.styles.root.height) : 0;
|
|
88
89
|
if (top) {
|
|
89
90
|
top = top - 50; // remove legendHeight
|
|
90
91
|
}
|
|
91
92
|
|
|
92
|
-
const orientation =
|
|
93
|
+
const orientation = props.showlegend === 'right' || props.showlegend === 'left' ? 'vertical' : 'horizontal';
|
|
93
94
|
return /*#__PURE__*/React.createElement(VictoryLegend, {
|
|
94
95
|
colorScale: colorScale,
|
|
95
96
|
name: 'legendData',
|
|
@@ -114,39 +115,75 @@ export class BaseChartComponent extends BaseComponent {
|
|
|
114
115
|
}
|
|
115
116
|
// x axis with vertical lines having grid stroke colors
|
|
116
117
|
getXaxis() {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
const minIndex = 0;
|
|
119
|
+
const maxIndex = this.state.xaxisDatakeyArr.length - 1;
|
|
120
|
+
const props = this.state.props;
|
|
121
|
+
const getTickValueLabel = props.xtickexpr;
|
|
120
122
|
return /*#__PURE__*/React.createElement(VictoryAxis, {
|
|
121
|
-
crossAxis:
|
|
122
|
-
label: (
|
|
123
|
+
crossAxis: false,
|
|
124
|
+
label: (props.xaxislabel || props.xaxisdatakey || "name") + (props.xunits ? `(${props.xunits})` : ''),
|
|
123
125
|
style: {
|
|
124
|
-
|
|
126
|
+
axisLabel: this.theme.mergeStyle(this.styles.axisLabel, this.styles.yAxisLabel, {
|
|
127
|
+
padding: props.yaxislabeldistance
|
|
128
|
+
}),
|
|
129
|
+
grid: props.hidegridxaxis ? {
|
|
130
|
+
stroke: null
|
|
131
|
+
} : this.theme.mergeStyle(this.styles.grid, this.styles.xGrid),
|
|
132
|
+
axis: props.showxaxis === false ? {
|
|
133
|
+
stroke: 'none'
|
|
134
|
+
} : this.theme.mergeStyle(this.styles.axis, this.styles.xAxis),
|
|
135
|
+
ticks: this.theme.mergeStyle(this.styles.ticks, this.styles.xTicks),
|
|
136
|
+
tickLabels: this.theme.mergeStyle(this.styles.tickLabels, this.styles.xTickLabels)
|
|
125
137
|
},
|
|
126
|
-
fixLabelOverlap: true,
|
|
138
|
+
fixLabelOverlap: props.autoadjustlabels ? true : false,
|
|
127
139
|
tickLabelComponent: /*#__PURE__*/React.createElement(VictoryLabel, {
|
|
128
|
-
angle:
|
|
140
|
+
angle: props.labelangle || 0
|
|
129
141
|
}),
|
|
130
142
|
theme: this.state.theme,
|
|
131
|
-
|
|
143
|
+
tickCount: this.state.xaxisDatakeyArr.length,
|
|
144
|
+
invertAxis: this.isRTL,
|
|
145
|
+
tickFormat: (d, i, ticks) => {
|
|
146
|
+
if (getTickValueLabel) {
|
|
147
|
+
return getTickValueLabel(this.state.xaxisDatakeyArr[d], i, (ticks || []).length);
|
|
148
|
+
} else if (this.state.xaxisDatakeyArr) {
|
|
149
|
+
return this.state.xaxisDatakeyArr[d];
|
|
150
|
+
}
|
|
151
|
+
return '';
|
|
152
|
+
}
|
|
132
153
|
});
|
|
133
154
|
}
|
|
155
|
+
|
|
134
156
|
/* y axis with horizontal lines having grid stroke colors*/
|
|
135
157
|
getYAxis() {
|
|
136
|
-
|
|
158
|
+
const props = this.state.props;
|
|
159
|
+
if (props.showyaxis === false) {
|
|
137
160
|
return null;
|
|
138
161
|
}
|
|
162
|
+
const getTickValueLabel = props.ytickexpr;
|
|
139
163
|
return /*#__PURE__*/React.createElement(VictoryAxis, {
|
|
140
|
-
crossAxis:
|
|
141
|
-
label: (
|
|
164
|
+
crossAxis: false,
|
|
165
|
+
label: (props.yaxislabel || props.yaxisdatakey) + (props.yunits ? `(${props.yunits})` : ''),
|
|
142
166
|
style: {
|
|
143
|
-
axisLabel: {
|
|
144
|
-
padding:
|
|
145
|
-
},
|
|
146
|
-
grid:
|
|
167
|
+
axisLabel: this.theme.mergeStyle(this.styles.axisLabel, this.styles.yAxisLabel, {
|
|
168
|
+
padding: props.yaxislabeldistance
|
|
169
|
+
}),
|
|
170
|
+
grid: props.hidegridyaxis ? {
|
|
171
|
+
stroke: null
|
|
172
|
+
} : this.theme.mergeStyle(this.styles.grid, this.styles.yGrid),
|
|
173
|
+
axis: props.showxaxis === false ? {
|
|
174
|
+
stroke: 'none'
|
|
175
|
+
} : this.theme.mergeStyle(this.styles.axis, this.styles.yAxis),
|
|
176
|
+
ticks: this.theme.mergeStyle(this.styles.ticks, this.styles.yTicks),
|
|
177
|
+
tickLabels: this.theme.mergeStyle(this.styles.tickLabels, this.styles.yTickLabels)
|
|
147
178
|
},
|
|
179
|
+
fixLabelOverlap: props.autoadjustlabels ? true : false,
|
|
148
180
|
theme: this.state.theme,
|
|
149
|
-
tickFormat:
|
|
181
|
+
tickFormat: (d, i, ticks) => {
|
|
182
|
+
if (getTickValueLabel) {
|
|
183
|
+
return getTickValueLabel(d, i, (ticks || []).length);
|
|
184
|
+
}
|
|
185
|
+
return this.abbreviateNumber(d);
|
|
186
|
+
},
|
|
150
187
|
dependentAxis: true
|
|
151
188
|
});
|
|
152
189
|
}
|
|
@@ -158,7 +195,8 @@ export class BaseChartComponent extends BaseComponent {
|
|
|
158
195
|
|
|
159
196
|
// Check whether X/Y Domain was set to Min and is supported for the present chart
|
|
160
197
|
isAxisDomainValid(axis) {
|
|
161
|
-
|
|
198
|
+
const props = this.state.props;
|
|
199
|
+
if (get(props, axis + 'domain') === 'Min' && this.isAxisDomainSupported(props.type)) {
|
|
162
200
|
return true;
|
|
163
201
|
}
|
|
164
202
|
return false;
|
|
@@ -208,7 +246,7 @@ export class BaseChartComponent extends BaseComponent {
|
|
|
208
246
|
}
|
|
209
247
|
const xValues = {};
|
|
210
248
|
/*
|
|
211
|
-
compute the min x
|
|
249
|
+
compute the min x valuex
|
|
212
250
|
eg: When data has objects
|
|
213
251
|
input: [{x:1, y:2}, {x:2, y:3}, {x:3, y:4}]
|
|
214
252
|
min x: 1
|
|
@@ -300,7 +338,7 @@ export class BaseChartComponent extends BaseComponent {
|
|
|
300
338
|
if (!colorsToUse.length) {
|
|
301
339
|
colorsToUse = ThemeFactory.getColorsObj(themeName);
|
|
302
340
|
}
|
|
303
|
-
themeToUse = ThemeFactory.getTheme(themeName,
|
|
341
|
+
themeToUse = ThemeFactory.getTheme(themeName, props.styles, colorsToUse);
|
|
304
342
|
} else if (typeof themeName === 'object') {
|
|
305
343
|
// if theme is passed as an object then use that custom theme.
|
|
306
344
|
themeToUse = props.theme;
|
|
@@ -311,9 +349,10 @@ export class BaseChartComponent extends BaseComponent {
|
|
|
311
349
|
});
|
|
312
350
|
}
|
|
313
351
|
prepareLegendData() {
|
|
352
|
+
const props = this.state.props;
|
|
314
353
|
if (this.state.yAxis) {
|
|
315
354
|
let ldata;
|
|
316
|
-
if (
|
|
355
|
+
if (props.type === 'Stack') {
|
|
317
356
|
const data = orderBy(this.state.data[0], 'y', 'asc');
|
|
318
357
|
ldata = data.map(d => {
|
|
319
358
|
return {
|
|
@@ -366,8 +405,9 @@ export class BaseChartComponent extends BaseComponent {
|
|
|
366
405
|
return value;
|
|
367
406
|
}
|
|
368
407
|
prepareDataItems(dataset) {
|
|
369
|
-
|
|
370
|
-
let
|
|
408
|
+
const props = this.state.props;
|
|
409
|
+
let xaxis = props.xaxisdatakey;
|
|
410
|
+
let yaxis = props.yaxisdatakey;
|
|
371
411
|
let xaxisDatakeyArr = [];
|
|
372
412
|
let datasets = [];
|
|
373
413
|
if (xaxis && yaxis) {
|
|
@@ -384,11 +424,11 @@ export class BaseChartComponent extends BaseComponent {
|
|
|
384
424
|
x: xVal,
|
|
385
425
|
y: yVal
|
|
386
426
|
};
|
|
387
|
-
if (
|
|
388
|
-
set(dataObj, 'size', get(o,
|
|
427
|
+
if (props.bubblesize) {
|
|
428
|
+
set(dataObj, 'size', get(o, props.bubblesize, 5));
|
|
389
429
|
}
|
|
390
|
-
if (
|
|
391
|
-
set(dataObj, 'symbol', shapes[
|
|
430
|
+
if (props.shape) {
|
|
431
|
+
set(dataObj, 'symbol', shapes[props.shape]);
|
|
392
432
|
}
|
|
393
433
|
return dataObj;
|
|
394
434
|
}));
|
|
@@ -396,7 +436,7 @@ export class BaseChartComponent extends BaseComponent {
|
|
|
396
436
|
});
|
|
397
437
|
// chartTransform
|
|
398
438
|
this.invokeEventCallback('onTransform', [undefined, this.proxy]);
|
|
399
|
-
if (
|
|
439
|
+
if (props.type == 'Pie' || props.type === 'Donut') {
|
|
400
440
|
// for animation effect
|
|
401
441
|
setTimeout(() => {
|
|
402
442
|
this.updateState({
|
|
@@ -408,23 +448,25 @@ export class BaseChartComponent extends BaseComponent {
|
|
|
408
448
|
}
|
|
409
449
|
}
|
|
410
450
|
renderLoadingIcon() {
|
|
451
|
+
const props = this.state.props;
|
|
411
452
|
return /*#__PURE__*/React.createElement(WmIcon, {
|
|
412
453
|
styles: this.styles.loadingIcon,
|
|
413
|
-
iconclass:
|
|
414
|
-
caption:
|
|
454
|
+
iconclass: props.loadingicon,
|
|
455
|
+
caption: props.loadingdatamsg
|
|
415
456
|
});
|
|
416
457
|
}
|
|
417
458
|
updateData(datasets, yPts, xaxisDatakeyArr) {
|
|
459
|
+
const props = this.state.props;
|
|
418
460
|
this.updateState({
|
|
419
461
|
data: datasets,
|
|
420
462
|
yAxis: yPts,
|
|
421
463
|
xaxisDatakeyArr: xaxisDatakeyArr
|
|
422
464
|
}, () => {
|
|
423
465
|
this.prepareLegendData();
|
|
424
|
-
if (!
|
|
466
|
+
if (!props.labeltype || props.labeltype === 'percent') {
|
|
425
467
|
this.setTotal(this.state.data[0]);
|
|
426
468
|
}
|
|
427
|
-
if (this.isAxisDomainSupported(
|
|
469
|
+
if (this.isAxisDomainSupported(props.type) && (props.ydomain || props.xdomain)) {
|
|
428
470
|
this.setDomainValues();
|
|
429
471
|
}
|
|
430
472
|
this.updateState({
|
|
@@ -443,6 +485,7 @@ export class BaseChartComponent extends BaseComponent {
|
|
|
443
485
|
}
|
|
444
486
|
onPropertyChange(name, $new, $old) {
|
|
445
487
|
super.onPropertyChange(name, $new, $old);
|
|
488
|
+
const props = this.state.props;
|
|
446
489
|
let units = '';
|
|
447
490
|
switch (name) {
|
|
448
491
|
case 'customcolors':
|
|
@@ -457,7 +500,7 @@ export class BaseChartComponent extends BaseComponent {
|
|
|
457
500
|
});
|
|
458
501
|
break;
|
|
459
502
|
case 'theme':
|
|
460
|
-
this.applyTheme(
|
|
503
|
+
this.applyTheme(props);
|
|
461
504
|
break;
|
|
462
505
|
case 'dataset':
|
|
463
506
|
if (!isArray($new)) {
|
|
@@ -470,16 +513,16 @@ export class BaseChartComponent extends BaseComponent {
|
|
|
470
513
|
$new && this.prepareDataItems($new);
|
|
471
514
|
break;
|
|
472
515
|
case 'xaxislabel':
|
|
473
|
-
if (
|
|
474
|
-
units = ' (' +
|
|
516
|
+
if (props.xunits) {
|
|
517
|
+
units = ' (' + props.xunits + ')';
|
|
475
518
|
}
|
|
476
519
|
this.updateState({
|
|
477
520
|
xLabel: $new + units
|
|
478
521
|
});
|
|
479
522
|
break;
|
|
480
523
|
case 'yaxislabel':
|
|
481
|
-
if (
|
|
482
|
-
units = ' (' +
|
|
524
|
+
if (props.yunits) {
|
|
525
|
+
units = ' (' + props.yunits + ')';
|
|
483
526
|
}
|
|
484
527
|
this.updateState({
|
|
485
528
|
yLabel: $new + units
|