@wavemaker/app-rn-runtime 11.4.0-next.1417074 → 11.4.0-next.1417076
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/actions/navigation-action.js +14 -2
- app-rn-runtime/actions/navigation-action.js.map +1 -1
- app-rn-runtime/components/basic/anchor/anchor.component.js +1 -0
- app-rn-runtime/components/basic/anchor/anchor.component.js.map +1 -1
- app-rn-runtime/components/chart/basechart.props.js +1 -0
- app-rn-runtime/components/chart/basechart.props.js.map +1 -1
- app-rn-runtime/components/chart/basechart.styles.js +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/container/accordion/accordion.component.js +20 -8
- app-rn-runtime/components/container/accordion/accordion.component.js.map +1 -1
- app-rn-runtime/components/container/accordion/accordionpane/accordionpane.component.js +8 -2
- app-rn-runtime/components/container/accordion/accordionpane/accordionpane.component.js.map +1 -1
- app-rn-runtime/components/data/list/list.component.js +8 -3
- app-rn-runtime/components/data/list/list.component.js.map +1 -1
- app-rn-runtime/components/dialogs/dialog/dialog.component.js +5 -2
- app-rn-runtime/components/dialogs/dialog/dialog.component.js.map +1 -1
- app-rn-runtime/core/utils.js +15 -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 +2 -2
- app-rn-runtime/runtime/base-fragment.component.js.map +1 -1
- app-rn-runtime/runtime/base-page.component.js +2 -0
- app-rn-runtime/runtime/base-page.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/service-variable.js +5 -0
- app-rn-runtime/variables/service-variable.js.map +1 -1
|
@@ -12,8 +12,20 @@ export class NavigationAction extends BaseAction {
|
|
|
12
12
|
params = (_params = params) !== null && _params !== void 0 && _params.data ? merge(this.config.paramProvider(), params.data) : merge(this.config.paramProvider(), this.dataSet);
|
|
13
13
|
this.notify(VariableEvents.BEFORE_INVOKE, [this, this.dataSet]);
|
|
14
14
|
return super.invoke(params, onSuccess, onError).then(() => {
|
|
15
|
-
var _config$appConfig$cur, _config$appConfig$cur2;
|
|
16
|
-
|
|
15
|
+
var _config$appConfig$cur, _this$config$_context, _params2, _this$config$_context2, _params3, _config$appConfig$cur2;
|
|
16
|
+
switch (config.operation) {
|
|
17
|
+
case 'goToPreviousPage':
|
|
18
|
+
(_config$appConfig$cur = config.appConfig.currentPage) === null || _config$appConfig$cur === void 0 ? void 0 : _config$appConfig$cur.goBack();
|
|
19
|
+
break;
|
|
20
|
+
case 'gotoTab':
|
|
21
|
+
(_this$config$_context = this.config._context) === null || _this$config$_context === void 0 ? void 0 : _this$config$_context.Widgets[(_params2 = params) === null || _params2 === void 0 ? void 0 : _params2.tabName].select();
|
|
22
|
+
break;
|
|
23
|
+
case 'gotoAccordion':
|
|
24
|
+
(_this$config$_context2 = this.config._context) === null || _this$config$_context2 === void 0 ? void 0 : _this$config$_context2.Widgets[(_params3 = params) === null || _params3 === void 0 ? void 0 : _params3.accordionName].expand();
|
|
25
|
+
break;
|
|
26
|
+
case 'gotoPage':
|
|
27
|
+
(_config$appConfig$cur2 = config.appConfig.currentPage) === null || _config$appConfig$cur2 === void 0 ? void 0 : _config$appConfig$cur2.goToPage(this.params.pageName, this.params);
|
|
28
|
+
}
|
|
17
29
|
}).then(() => {
|
|
18
30
|
config.onSuccess && config.onSuccess(this, this.dataSet);
|
|
19
31
|
this.notify(VariableEvents.SUCCESS, [this, this.dataSet]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["VariableEvents","BaseAction","merge","NavigationAction","constructor","config","invoke","params","onSuccess","onError","_params","data","paramProvider","dataSet","notify","BEFORE_INVOKE","then","_config$appConfig$cur","_config$appConfig$cur2","operation","appConfig","currentPage","goBack","goToPage","pageName","SUCCESS","ERROR","AFTER_INVOKE","navigate"],"sources":["navigation-action.ts"],"sourcesContent":["import AppConfig from \"@wavemaker/app-rn-runtime/core/AppConfig\";\nimport { VariableEvents } from \"@wavemaker/app-rn-runtime/variables/base-variable\";\nimport { ActionConfig, BaseAction } from \"./base-action\";\nimport {merge} from \"lodash\";\n\nexport interface NavigationActionConfig extends ActionConfig {\n appConfig: AppConfig;\n operation: string;\n}\n\nexport class NavigationAction extends BaseAction<NavigationActionConfig> {\n constructor(config: NavigationActionConfig) {\n super(config);\n }\n\n public invoke(params?: {}, onSuccess?: Function, onError?: Function): Promise<NavigationAction> {\n const config = this.config;\n // @ts-ignore\n params = params?.data ? merge(this.config.paramProvider(), params.data) : merge(this.config.paramProvider(), this.dataSet);\n this.notify(VariableEvents.BEFORE_INVOKE, [this, this.dataSet]);\n return super.invoke(params, onSuccess, onError).then(() => {\n config.operation
|
|
1
|
+
{"version":3,"names":["VariableEvents","BaseAction","merge","NavigationAction","constructor","config","invoke","params","onSuccess","onError","_params","data","paramProvider","dataSet","notify","BEFORE_INVOKE","then","_config$appConfig$cur","_this$config$_context","_params2","_this$config$_context2","_params3","_config$appConfig$cur2","operation","appConfig","currentPage","goBack","_context","Widgets","tabName","select","accordionName","expand","goToPage","pageName","SUCCESS","ERROR","AFTER_INVOKE","navigate"],"sources":["navigation-action.ts"],"sourcesContent":["import AppConfig from \"@wavemaker/app-rn-runtime/core/AppConfig\";\nimport { VariableEvents } from \"@wavemaker/app-rn-runtime/variables/base-variable\";\nimport { ActionConfig, BaseAction } from \"./base-action\";\nimport {merge} from \"lodash\";\n\nexport interface NavigationActionConfig extends ActionConfig {\n appConfig: AppConfig;\n operation: string;\n _context: any;\n}\n\nexport class NavigationAction extends BaseAction<NavigationActionConfig> {\n constructor(config: NavigationActionConfig) {\n super(config);\n }\n\n public invoke(params?: {}, onSuccess?: Function, onError?: Function): Promise<NavigationAction> {\n const config = this.config;\n // @ts-ignore\n params = params?.data ? merge(this.config.paramProvider(), params.data) : merge(this.config.paramProvider(), this.dataSet);\n this.notify(VariableEvents.BEFORE_INVOKE, [this, this.dataSet]);\n return super.invoke(params, onSuccess, onError).then(() => {\n switch(config.operation) {\n case 'goToPreviousPage':\n config.appConfig.currentPage?.goBack();\n break;\n case 'gotoTab':\n this.config._context?.Widgets[(params as any)?.tabName].select();\n break;\n case 'gotoAccordion':\n this.config._context?.Widgets[(params as any)?.accordionName].expand();\n break;\n case 'gotoPage' : \n config.appConfig.currentPage?.goToPage(this.params.pageName, this.params);\n }\n }).then(() => {\n config.onSuccess && config.onSuccess(this, this.dataSet);\n this.notify(VariableEvents.SUCCESS, [this, this.dataSet]);\n }, () => {\n config.onError && config.onError(this, null);\n this.notify(VariableEvents.ERROR, [this, this.dataSet]);\n }).then(() => {\n this.notify(VariableEvents.AFTER_INVOKE, [this, this.dataSet]);\n return this;\n });\n }\n\n public navigate(params?: {}, onSuccess?: Function, onError?: Function): Promise<NavigationAction> {\n return this.invoke(params, onSuccess, onError);\n }\n}\n"],"mappings":"AACA,SAASA,cAAc,QAAQ,mDAAmD;AAClF,SAAuBC,UAAU,QAAQ,eAAe;AACxD,SAAQC,KAAK,QAAO,QAAQ;AAQ5B,OAAO,MAAMC,gBAAgB,SAASF,UAAU,CAAyB;EACrEG,WAAWA,CAACC,MAA8B,EAAE;IACxC,KAAK,CAACA,MAAM,CAAC;EACjB;EAEOC,MAAMA,CAACC,MAAW,EAAEC,SAAoB,EAAEC,OAAkB,EAA6B;IAAA,IAAAC,OAAA;IAC5F,MAAML,MAAM,GA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CAAAV,sBAAA,GAAAjB,MAAM,CAACmB,SAAS,CAACC,WAAW,cAAAH,sBAAA,uBAA5BA,sBAAA,CAA8BW,QAAQ,CAAC,IAAI,CAAC1B,MAAM,CAAC2B,QAAQ,EAAE,IAAI,CAAC3B,MAAM,CAAC;MACjF;IACJ,CAAC,CAAC,CAACS,IAAI,CAAC,MAAM;MACVX,MAAM,CAACG,SAAS,IAAIH,MAAM,CAACG,SAAS,CAAC,IAAI,EAAE,IAAI,CAACK,OAAO,CAAC;MACxD,IAAI,CAACC,MAAM,CAACd,cAAc,CAACmC,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,CAACtB,OAAO,CAAC,CAAC;IAC7D,CAAC,EAAE,MAAM;MACLR,MAAM,CAACI,OAAO,IAAIJ,MAAM,CAACI,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC;MAC5C,IAAI,CAACK,MAAM,CAACd,cAAc,CAACoC,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,CAACvB,OAAO,CAAC,CAAC;IAC3D,CAAC,CAAC,CAACG,IAAI,CAAC,MAAM;MACV,IAAI,CAACF,MAAM,CAACd,cAAc,CAACqC,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,CAACxB,OAAO,CAAC,CAAC;MAC9D,OAAO,IAAI;IACf,CAAC,CAAC;EACN;EAEOyB,QAAQA,CAAC/B,MAAW,EAAEC,SAAoB,EAAEC,OAAkB,EAA6B;IAC9F,OAAO,IAAI,CAACH,MAAM,CAACC,MAAM,EAAEC,SAAS,EAAEC,OAAO,CAAC;EAClD;AACJ"}
|
|
@@ -53,6 +53,7 @@ export default class WmAnchor extends BaseComponent {
|
|
|
53
53
|
justifyContent: 'center'
|
|
54
54
|
}
|
|
55
55
|
}, /*#__PURE__*/React.createElement(Tappable, {
|
|
56
|
+
target: this,
|
|
56
57
|
styles: [this.styles.root, this.styles.root.width && this.styles.root.height ? {
|
|
57
58
|
width: '100%',
|
|
58
59
|
height: '100%'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Text","Badge","BaseComponent","BaseComponentState","Tappable","WmIcon","encodeUrl","NavigationServiceConsumer","WmAnchorProps","DEFAULT_CLASS","Animatedview","createSkeleton","WmAnchorState","WmAnchor","constructor","props","onTap","navigationService","e","state","hyperlink","link","encodeurl","openUrl","target","invokeEventCallback","proxy","renderSkeleton","theme","styles","skeleton","root","width","skeletonwidth","height","skeletonheight","renderWidget","icon","text","color","createElement","name","iconclass","badge","badgevalue","undefined","style","entryanimation","animation","justifyContent","flexDirection","iconposition","_background","caption"],"sources":["anchor.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Text } from 'react-native';\nimport { Badge } from 'react-native-paper';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { TapEvent, Tappable } from '@wavemaker/app-rn-runtime/core/tappable.component';\nimport WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';\nimport { encodeUrl } from '@wavemaker/app-rn-runtime/core/utils';\nimport NavigationService, { NavigationServiceConsumer } from '@wavemaker/app-rn-runtime/core/navigation.service';\n\nimport WmAnchorProps from './anchor.props';\nimport { DEFAULT_CLASS, WmAnchorStyles } from './anchor.styles';\nimport { Animatedview } from '@wavemaker/app-rn-runtime/components/basic/animatedview.component';\nimport { createSkeleton } from '../skeleton/skeleton.component';\n\nexport class WmAnchorState extends BaseComponentState<WmAnchorProps> {\n\n}\n\nexport default class WmAnchor extends BaseComponent<WmAnchorProps, WmAnchorState, WmAnchorStyles> {\n\n constructor(props: WmAnchorProps) {\n super(props, DEFAULT_CLASS, new WmAnchorProps());\n }\n\n onTap(navigationService: NavigationService, e: TapEvent) {\n const props = this.state.props;\n if (props.hyperlink) {\n const link = props.encodeurl ? encodeUrl(props.hyperlink) : props.hyperlink;\n navigationService.openUrl(link, {\n target: this.state.props.target\n });\n }\n this.invokeEventCallback('onTap', [e, this.proxy]);\n }\n\n public renderSkeleton(props: WmAnchorProps){\n return createSkeleton(this.theme, this.styles.skeleton, {\n ...this.styles.root,\n width: this.props.skeletonwidth || this.styles.root.width,\n height: this.props.skeletonheight || this.styles.root.height\n });\n }\n\n renderWidget(props: WmAnchorProps) {\n if (this.styles.icon && this.styles.icon.text) {\n this.styles.icon.text.color = this.styles.text.color;\n }\n const icon = (<WmIcon\n styles={this.styles.icon} name={props.name + '_icon'} iconclass={props.iconclass}></WmIcon>);\n //@ts-ignore\n const badge = props.badgevalue != undefined ? (<Badge style={this.styles.badge}>{props.badgevalue}</Badge>): null;\n return (\n <NavigationServiceConsumer>\n {(navigationService: NavigationService) =>\n (<Animatedview entryanimation={props.animation} style={{width: this.styles.root.width, height: this.styles.root.height, justifyContent: 'center'}}>\n <Tappable styles={[this.styles.root, this.styles.root.width && this.styles.root.height ? { width: '100%', height: '100%'} : null, {flexDirection: props.iconposition === 'top' ? 'column': 'row'}]}\n onTap={props.hyperlink || props.onTap ? (e: TapEvent) => this.onTap(navigationService, e) : undefined}>\n {this._background}\n {props.iconposition === 'top' && icon}\n {props.iconposition === 'left' && icon}\n {props.caption ? (<Text style={this.styles.text}>{props.caption}</Text>) : null}\n {props.iconposition === 'right' && icon}\n {badge}\n </Tappable>\n </Animatedview>)\n }\n </NavigationServiceConsumer>\n );\n }\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AACjG,SAAmBC,QAAQ,QAAQ,mDAAmD;AACtF,OAAOC,MAAM,MAAM,gEAAgE;AACnF,SAASC,SAAS,QAAQ,sCAAsC;AAChE,SAA4BC,yBAAyB,QAAQ,mDAAmD;AAEhH,OAAOC,aAAa,MAAM,gBAAgB;AAC1C,SAASC,aAAa,QAAwB,iBAAiB;AAC/D,SAASC,YAAY,QAAQ,mEAAmE;AAChG,SAASC,cAAc,QAAQ,gCAAgC;AAE/D,OAAO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Q,IAAI,CAACC,IAAI,CAACC,KAAK,GAAG,IAAI,CAACV,MAAM,CAACS,IAAI,CAACC,KAAK;IACtD;IACA,MAAMF,IAAI,gBAAItC,KAAA,CAAAyC,aAAA,CAACnC,MAAM;MACnBwB,MAAM,EAAE,IAAI,CAACA,MAAM,CAACQ,IAAK;MAACI,IAAI,EAAE1B,KAAK,CAAC0B,IAAI,GAAG,OAAQ;MAACC,SAAS,EAAE3B,KAAK,CAAC2B;IAAU,CAAS,CAAE;IAC9F;IACA,MAAMC,KAAK,GAAG5B,KAAK,CAAC6B,UAAU,IAAIC,SAAS,gBAAI9C,KAAA,CAAAyC,aAAA,CAACvC,KAAK;MAAC6C,KAAK,EAAE,IAAI,CAACjB,MAAM,CAACc;IAAM,GAAE5B,KAAK,CAAC6B,UAAkB,CAAC,GAAG,IAAI;IACjH,oBACE7C,KAAA,CAAAyC,aAAA,CAACjC,yBAAyB,QACtBU,iBAAoC,iBACnClB,KAAA,CAAAyC,aAAA,CAAC9B,YAAY;MAACqC,cAAc,EAAEhC,KAAK,CAACiC,SAAU;MAACF,KAAK,EAAE;QAACd,KAAK,EAAE,IAAI,CAACH,MAAM,CAACE,IAAI,CAACC,KAAK;QAAEE,MAAM,EAAE,IAAI,CAACL,MAAM,CAACE,IAAI,CAACG,MAAM;QAAEe,cAAc,EAAE;MAAQ;IAAE,gBAChJlD,KAAA,CAAAyC,aAAA,CAACpC,QAAQ;
|
|
1
|
+
{"version":3,"names":["React","Text","Badge","BaseComponent","BaseComponentState","Tappable","WmIcon","encodeUrl","NavigationServiceConsumer","WmAnchorProps","DEFAULT_CLASS","Animatedview","createSkeleton","WmAnchorState","WmAnchor","constructor","props","onTap","navigationService","e","state","hyperlink","link","encodeurl","openUrl","target","invokeEventCallback","proxy","renderSkeleton","theme","styles","skeleton","root","width","skeletonwidth","height","skeletonheight","renderWidget","icon","text","color","createElement","name","iconclass","badge","badgevalue","undefined","style","entryanimation","animation","justifyContent","flexDirection","iconposition","_background","caption"],"sources":["anchor.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Text } from 'react-native';\nimport { Badge } from 'react-native-paper';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { TapEvent, Tappable } from '@wavemaker/app-rn-runtime/core/tappable.component';\nimport WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';\nimport { encodeUrl } from '@wavemaker/app-rn-runtime/core/utils';\nimport NavigationService, { NavigationServiceConsumer } from '@wavemaker/app-rn-runtime/core/navigation.service';\n\nimport WmAnchorProps from './anchor.props';\nimport { DEFAULT_CLASS, WmAnchorStyles } from './anchor.styles';\nimport { Animatedview } from '@wavemaker/app-rn-runtime/components/basic/animatedview.component';\nimport { createSkeleton } from '../skeleton/skeleton.component';\n\nexport class WmAnchorState extends BaseComponentState<WmAnchorProps> {\n\n}\n\nexport default class WmAnchor extends BaseComponent<WmAnchorProps, WmAnchorState, WmAnchorStyles> {\n\n constructor(props: WmAnchorProps) {\n super(props, DEFAULT_CLASS, new WmAnchorProps());\n }\n\n onTap(navigationService: NavigationService, e: TapEvent) {\n const props = this.state.props;\n if (props.hyperlink) {\n const link = props.encodeurl ? encodeUrl(props.hyperlink) : props.hyperlink;\n navigationService.openUrl(link, {\n target: this.state.props.target\n });\n }\n this.invokeEventCallback('onTap', [e, this.proxy]);\n }\n\n public renderSkeleton(props: WmAnchorProps){\n return createSkeleton(this.theme, this.styles.skeleton, {\n ...this.styles.root,\n width: this.props.skeletonwidth || this.styles.root.width,\n height: this.props.skeletonheight || this.styles.root.height\n });\n }\n\n renderWidget(props: WmAnchorProps) {\n if (this.styles.icon && this.styles.icon.text) {\n this.styles.icon.text.color = this.styles.text.color;\n }\n const icon = (<WmIcon\n styles={this.styles.icon} name={props.name + '_icon'} iconclass={props.iconclass}></WmIcon>);\n //@ts-ignore\n const badge = props.badgevalue != undefined ? (<Badge style={this.styles.badge}>{props.badgevalue}</Badge>): null;\n return (\n <NavigationServiceConsumer>\n {(navigationService: NavigationService) =>\n (<Animatedview entryanimation={props.animation} style={{width: this.styles.root.width, height: this.styles.root.height, justifyContent: 'center'}}>\n <Tappable target={this} styles={[this.styles.root, this.styles.root.width && this.styles.root.height ? { width: '100%', height: '100%'} : null, {flexDirection: props.iconposition === 'top' ? 'column': 'row'}]}\n onTap={props.hyperlink || props.onTap ? (e: TapEvent) => this.onTap(navigationService, e) : undefined}>\n {this._background}\n {props.iconposition === 'top' && icon}\n {props.iconposition === 'left' && icon}\n {props.caption ? (<Text style={this.styles.text}>{props.caption}</Text>) : null}\n {props.iconposition === 'right' && icon}\n {badge}\n </Tappable>\n </Animatedview>)\n }\n </NavigationServiceConsumer>\n );\n }\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AACjG,SAAmBC,QAAQ,QAAQ,mDAAmD;AACtF,OAAOC,MAAM,MAAM,gEAAgE;AACnF,SAASC,SAAS,QAAQ,sCAAsC;AAChE,SAA4BC,yBAAyB,QAAQ,mDAAmD;AAEhH,OAAOC,aAAa,MAAM,gBAAgB;AAC1C,SAASC,aAAa,QAAwB,iBAAiB;AAC/D,SAASC,YAAY,QAAQ,mEAAmE;AAChG,SAASC,cAAc,QAAQ,gCAAgC;AAE/D,OAAO,MAAMC,aAAa,SAAST,kBAAkB,CAAgB;AAIrE,eAAe,MAAMU,QAAQ,SAASX,aAAa,CAA+C;EAEhGY,WAAWA,CAACC,KAAoB,EAAE;IAChC,KAAK,CAACA,KAAK,EAAEN,aAAa,EAAE,IAAID,aAAa,CAAC,CAAC,CAAC;EAClD;EAEAQ,KAAKA,CAACC,iBAAoC,EAAEC,CAAW,EAAE;IACvD,MAAMH,KAAK,GAAG,IAAI,CAACI,KAAK,CAACJ,KAAK;IAC9B,IAAIA,KAAK,CAACK,SAAS,EAAE;MACnB,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AAC8C,KAAK,EAAE,IAAI,CAACjB,MAAM,CAACS;IAAK,GAAEvB,KAAK,CAACsC,OAAc,CAAC,GAAI,IAAI,EAC9EtC,KAAK,CAACoC,YAAY,KAAK,OAAO,IAAId,IAAI,EACtCM,KACO,CACE,CAES,CAAC;EAEhC;AACF"}
|
|
@@ -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.chartHeight/2)}}\n labelPlacement={props.labelplacement}\n />\n </Svg>) : null}\n </View>\n );\n }\n}\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAA4BC,IAAI,QAAQ,cAAc;AACtD,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,SAAwBC,UAAU,QAAQ,gBAAgB;AAE1D,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,SAASC,aAAa,QAA0B,oBAAoB;AACpE,SACEC,kBAAkB,EAClBC,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AAQ;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,qBACF,EAAE;IAAAA,eAAA,sBACD,CAAC;IAAAA,eAAA,uBACA,CAAC;IAAAA,eAAA,kBACN,CAAC;EAAA;AACb;AAEA,eAAe,MAAMC,UAAU,SAASR,kBAAkB,CAAqD;EAE7GK,WAAWA,CAACI,KAAsB,EAAE;IAClC,KAAK,CAACA,KAAK,EAAEZ,aAAa,EAAEY,KAAK,CAACC,IAAI,KAAK,OAAO,GAAG,IAAIR,iBAAiB,CAAC,CAAC,GAAG,IAAIN,eAAe,CAA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AU,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"}
|
|
@@ -2,7 +2,7 @@ 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 { Text, View } from 'react-native';
|
|
5
|
+
import { Text, TouchableOpacity, View } from 'react-native';
|
|
6
6
|
import { Badge } from 'react-native-paper';
|
|
7
7
|
import { isArray } from 'lodash';
|
|
8
8
|
import { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';
|
|
@@ -31,6 +31,14 @@ export default class WmAccordion extends BaseComponent {
|
|
|
31
31
|
this.accordionPanes[this.newIndex++] = accordionPane;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
+
expand(accordionName) {
|
|
35
|
+
const i = this.accordionPanes.findIndex(t => t.props.name === accordionName);
|
|
36
|
+
this.toggle(i + 1, true);
|
|
37
|
+
}
|
|
38
|
+
collapse(accordionName) {
|
|
39
|
+
const i = this.accordionPanes.findIndex(t => t.props.name === accordionName);
|
|
40
|
+
this.toggle(i + 1, false);
|
|
41
|
+
}
|
|
34
42
|
expandCollapseIcon(item) {
|
|
35
43
|
let showBadge = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
36
44
|
let showIcon = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -64,10 +72,10 @@ export default class WmAccordion extends BaseComponent {
|
|
|
64
72
|
return /*#__PURE__*/React.createElement(View, {
|
|
65
73
|
style: this.styles.pane,
|
|
66
74
|
key: item.props.name
|
|
67
|
-
}, /*#__PURE__*/React.createElement(
|
|
75
|
+
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
68
76
|
key: 'accordionpane_' + (index + 1),
|
|
69
77
|
style: [this.styles.header, index === 0 ? this.styles.firstHeader : null, index === accordionpanes.length - 1 && !isExpanded ? this.styles.lastHeader : null, isExpanded ? this.styles.activeHeader : {}],
|
|
70
|
-
|
|
78
|
+
onPress: this.toggle.bind(this, index + 1, !isExpanded)
|
|
71
79
|
}, this.expandCollapseIcon(item, false, showIconOnLeft, true, isExpanded), item.props.iconclass ? /*#__PURE__*/React.createElement(WmIcon, {
|
|
72
80
|
styles: this.styles.icon,
|
|
73
81
|
name: item.props.name + '_icon',
|
|
@@ -84,17 +92,21 @@ export default class WmAccordion extends BaseComponent {
|
|
|
84
92
|
style: this.styles.subheading
|
|
85
93
|
}, item.props.description) : null), this.expandCollapseIcon(item, true, !showIconOnLeft, true, isExpanded)), item);
|
|
86
94
|
}
|
|
87
|
-
toggle(
|
|
88
|
-
let
|
|
89
|
-
expandedId =
|
|
95
|
+
toggle(index) {
|
|
96
|
+
let expand = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
97
|
+
let expandedId = expand ? index : -1;
|
|
98
|
+
let collapseId = expand ? -1 : index;
|
|
99
|
+
if (expand && this.state.isExpanded[expandedId - 1] || !expand && this.state.isExpanded[collapseId - 1] === false) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
90
102
|
if (collapseId < 0 && this.state.props.closeothers) {
|
|
91
103
|
collapseId = this.state.lastExpandedIndex;
|
|
92
104
|
}
|
|
93
105
|
const collapsedPane = this.accordionPanes[collapseId - 1];
|
|
94
|
-
collapsedPane === null || collapsedPane === void 0 ? void 0 : collapsedPane.
|
|
106
|
+
collapsedPane === null || collapsedPane === void 0 ? void 0 : collapsedPane.hide();
|
|
95
107
|
Promise.resolve().then(() => {
|
|
96
108
|
const expandedPane = expandedId ? this.accordionPanes[expandedId - 1] : null;
|
|
97
|
-
expandedPane === null || expandedPane === void 0 ? void 0 : expandedPane.
|
|
109
|
+
expandedPane === null || expandedPane === void 0 ? void 0 : expandedPane.show();
|
|
98
110
|
this.setState(state => {
|
|
99
111
|
if (collapseId > 0 && collapsedPane) {
|
|
100
112
|
state.isExpanded[collapseId - 1] = false;
|