@wavemaker/app-rn-runtime 11.7.1-rc.5605 → 11.7.2-next.26367
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/anchor/anchor.component.js.map +1 -1
- app-rn-runtime/components/basic/button/button.component.js +3 -7
- app-rn-runtime/components/basic/button/button.component.js.map +1 -1
- app-rn-runtime/components/basic/button/button.styles.js +2 -1
- app-rn-runtime/components/basic/button/button.styles.js.map +1 -1
- app-rn-runtime/components/basic/label/label.component.js +1 -1
- app-rn-runtime/components/basic/label/label.component.js.map +1 -1
- app-rn-runtime/components/chart/area-chart/area-chart.component.js +3 -13
- app-rn-runtime/components/chart/area-chart/area-chart.component.js.map +1 -1
- app-rn-runtime/components/chart/bar-chart/bar-chart.component.js +7 -36
- app-rn-runtime/components/chart/bar-chart/bar-chart.component.js.map +1 -1
- app-rn-runtime/components/chart/basechart.component.js +46 -70
- app-rn-runtime/components/chart/basechart.component.js.map +1 -1
- app-rn-runtime/components/chart/basechart.props.js +7 -0
- app-rn-runtime/components/chart/basechart.props.js.map +1 -1
- app-rn-runtime/components/chart/basechart.styles.js +10 -27
- app-rn-runtime/components/chart/basechart.styles.js.map +1 -1
- app-rn-runtime/components/chart/bubble-chart/bubble-chart.component.js +3 -13
- app-rn-runtime/components/chart/bubble-chart/bubble-chart.component.js.map +1 -1
- app-rn-runtime/components/chart/line-chart/line-chart.component.js +6 -36
- app-rn-runtime/components/chart/line-chart/line-chart.component.js.map +1 -1
- app-rn-runtime/components/chart/pie-chart/pie-chart.component.js +1 -12
- app-rn-runtime/components/chart/pie-chart/pie-chart.component.js.map +1 -1
- app-rn-runtime/components/chart/stack-chart/stack-chart.component.js +3 -13
- app-rn-runtime/components/chart/stack-chart/stack-chart.component.js.map +1 -1
- app-rn-runtime/components/container/container.component.js +1 -3
- app-rn-runtime/components/container/container.component.js.map +1 -1
- app-rn-runtime/components/container/panel/panel.component.js +1 -1
- app-rn-runtime/components/container/panel/panel.component.js.map +1 -1
- app-rn-runtime/components/data/form/form-action/form-action.component.js.map +1 -1
- app-rn-runtime/components/data/list/list.component.js +18 -25
- app-rn-runtime/components/data/list/list.component.js.map +1 -1
- app-rn-runtime/components/data/list/list.styles.js +2 -0
- app-rn-runtime/components/data/list/list.styles.js.map +1 -1
- app-rn-runtime/components/input/baseinput/baseinput.component.js +0 -2
- app-rn-runtime/components/input/baseinput/baseinput.component.js.map +1 -1
- app-rn-runtime/components/input/select/select.component.js +1 -3
- app-rn-runtime/components/input/select/select.component.js.map +1 -1
- app-rn-runtime/components/navigation/navbar/navbar.props.js.map +1 -1
- app-rn-runtime/components/navigation/navitem/navitem.component.js.map +1 -1
- app-rn-runtime/components/navigation/navitem/navitem.props.js.map +1 -1
- app-rn-runtime/components/navigation/popover/popover.component.js.map +1 -1
- app-rn-runtime/components/page/page.component.js +3 -13
- app-rn-runtime/components/page/page.component.js.map +1 -1
- app-rn-runtime/core/base.component.js +15 -21
- app-rn-runtime/core/base.component.js.map +1 -1
- app-rn-runtime/core/components/textinput.component.js +1 -1
- app-rn-runtime/core/components/textinput.component.js.map +1 -1
- app-rn-runtime/core/event-notifier.js +4 -13
- app-rn-runtime/core/event-notifier.js.map +1 -1
- app-rn-runtime/core/props.provider.js +1 -1
- app-rn-runtime/core/props.provider.js.map +1 -1
- app-rn-runtime/core/tappable.component.js +39 -75
- app-rn-runtime/core/tappable.component.js.map +1 -1
- app-rn-runtime/package.json +3 -3
- app-rn-runtime/runtime/base-partial.component.js +5 -10
- app-rn-runtime/runtime/base-partial.component.js.map +1 -1
- app-rn-runtime/styles/theme.variables.js +2 -1
- app-rn-runtime/styles/theme.variables.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Text","Badge","BaseComponent","BaseComponentState","Tappable","WmIcon","encodeUrl","AccessibilityWidgetType","getAccessibilityProps","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","iconclass","iconurl","name","iconheight","iconmargin","iconwidth","badgevalue","icon","text","color","createElement","id","getTestId","hint","badge","undefined","style","entryanimation","animation","justifyContent","_extends","getTestPropsForAction","flexDirection","iconposition","_background","caption","getTestPropsForLabel","ANCHOR","numberOfLines","nooflines"],"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 {
|
|
1
|
+
{"version":3,"names":["React","Text","Badge","BaseComponent","BaseComponentState","Tappable","WmIcon","encodeUrl","AccessibilityWidgetType","getAccessibilityProps","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","iconclass","iconurl","name","iconheight","iconmargin","iconwidth","badgevalue","icon","text","color","createElement","id","getTestId","hint","badge","undefined","style","entryanimation","animation","justifyContent","_extends","getTestPropsForAction","flexDirection","iconposition","_background","caption","getTestPropsForLabel","ANCHOR","numberOfLines","nooflines"],"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 { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility';\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 const {\n iconclass,\n iconurl,\n name,\n iconheight,\n iconmargin,\n iconwidth,\n badgevalue,\n } = props;\n \n if (this.styles.icon && this.styles.icon.text) {\n this.styles.icon.text.color = this.styles.text.color;\n }\n\n const icon = (iconclass || iconurl) && (\n <WmIcon\n id={this.getTestId('icon')}\n styles={this.styles.icon} \n hint={props?.hint}\n name={name + '_icon'}\n iconclass={iconclass}\n iconurl={iconurl}\n iconheight={iconheight}\n iconmargin={iconmargin}\n iconwidth={iconwidth}\n />\n ); \n //@ts-ignore\n const badge = badgevalue != undefined ? (<Badge style={this.styles.badge}>{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 {...this.getTestPropsForAction()} 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}\n {...this.getTestPropsForLabel('caption')} \n {...getAccessibilityProps(AccessibilityWidgetType.ANCHOR, props)}\n numberOfLines={props.nooflines}>{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,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,8CAA8C;AAC7G,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,SAASX,kBAAkB,CAAgB;AAIrE,eAAe,MAAMY,QAAQ,SAASb,aAAa,CAA+C;EAEhGc,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,GA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AAG,IAAI,EAAE;QAACyB,aAAa,EAAE5C,KAAK,CAAC6C,YAAY,KAAK,KAAK,GAAG,QAAQ,GAAE;MAAK,CAAC,CAAE;MACjP5C,KAAK,EAAED,KAAK,CAACK,SAAS,IAAIL,KAAK,CAACC,KAAK,GAAIE,CAAW,IAAK,IAAI,CAACF,KAAK,CAACC,iBAAiB,EAAEC,CAAC,CAAC,GAAGkC;IAAU,IACrG,IAAI,CAACS,WAAW,EAChB9C,KAAK,CAAC6C,YAAY,KAAK,KAAK,IAAIhB,IAAI,EACpC7B,KAAK,CAAC6C,YAAY,KAAK,MAAM,IAAIhB,IAAI,EACrC7B,KAAK,CAAC+C,OAAO,gBAAIjE,KAAA,CAAAkD,aAAA,CAACjD,IAAI,EAAA2D,QAAA;MAACJ,KAAK,EAAE,IAAI,CAACxB,MAAM,CAACgB;IAAK,GAC5C,IAAI,CAACkB,oBAAoB,CAAC,SAAS,CAAC,EACpCzD,qBAAqB,CAACD,uBAAuB,CAAC2D,MAAM,EAAEjD,KAAK,CAAC;MAChEkD,aAAa,EAAElD,KAAK,CAACmD;IAAU,IAAEnD,KAAK,CAAC+C,OAAc,CAAC,GAAI,IAAI,EAC7D/C,KAAK,CAAC6C,YAAY,KAAK,OAAO,IAAIhB,IAAI,EACtCO,KACO,CACE,CAES,CAAC;EAEhC;AACF"}
|
|
@@ -59,11 +59,8 @@ export default class WmButton extends BaseComponent {
|
|
|
59
59
|
paddingBottom: 0,
|
|
60
60
|
paddingLeft: 0,
|
|
61
61
|
paddingRight: 0,
|
|
62
|
-
overflow: 'hidden'
|
|
63
|
-
|
|
64
|
-
}, this.styles.root.height == "100%" ? {
|
|
65
|
-
flex: 1
|
|
66
|
-
} : {}]
|
|
62
|
+
overflow: 'hidden'
|
|
63
|
+
}]
|
|
67
64
|
// accessibilityProps={{...getAccessibilityProps(
|
|
68
65
|
// AccessibilityWidgetType.BUTTON,
|
|
69
66
|
// props
|
|
@@ -74,8 +71,7 @@ export default class WmButton extends BaseComponent {
|
|
|
74
71
|
paddingBottom: this.styles.root.paddingBottom,
|
|
75
72
|
paddingLeft: this.styles.root.paddingLeft,
|
|
76
73
|
paddingRight: this.styles.root.paddingRight,
|
|
77
|
-
|
|
78
|
-
height: this.styles.root.height ? '100%' : null,
|
|
74
|
+
height: '100%',
|
|
79
75
|
justifyContent: 'center'
|
|
80
76
|
},
|
|
81
77
|
rippleColor: this.styles.root.rippleColor,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Text","View","BaseComponent","BaseComponentState","Tappable","Badge","WmButtonProps","DEFAULT_CLASS","WmIcon","Animatedview","createSkeleton","AccessibilityWidgetType","getAccessibilityProps","WmButtonState","WmButton","constructor","props","prepareIcon","_ref","iconclass","iconurl","hint","name","iconsize","iconheight","iconmargin","iconwidth","createElement","_extends","getTestPropsForLabel","styles","icon","prepareBadge","style","badge","badgevalue","renderSkeleton","prop","theme","skeleton","root","width","skeletonwidth","height","skeletonheight","renderWidget","Fragment","entryanimation","animation","paddingTop","paddingBottom","paddingLeft","paddingRight","overflow","
|
|
1
|
+
{"version":3,"names":["React","Text","View","BaseComponent","BaseComponentState","Tappable","Badge","WmButtonProps","DEFAULT_CLASS","WmIcon","Animatedview","createSkeleton","AccessibilityWidgetType","getAccessibilityProps","WmButtonState","WmButton","constructor","props","prepareIcon","_ref","iconclass","iconurl","hint","name","iconsize","iconheight","iconmargin","iconwidth","createElement","_extends","getTestPropsForLabel","styles","icon","prepareBadge","style","badge","badgevalue","renderSkeleton","prop","theme","skeleton","root","width","skeletonwidth","height","skeletonheight","renderWidget","Fragment","entryanimation","animation","paddingTop","paddingBottom","paddingLeft","paddingRight","overflow","_background","justifyContent","rippleColor","target","getTestPropsForAction","accessibilityProps","BUTTON","content","flexDirection","iconposition","caption","text","importantForAccessibility"],"sources":["button.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';\nimport { Badge } from 'react-native-paper';\n\nimport WmButtonProps from './button.props';\nimport { DEFAULT_CLASS, WmButtonStyles } from './button.styles';\nimport WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';\nimport { Animatedview } from '@wavemaker/app-rn-runtime/components/basic/animatedview.component';\nimport { createSkeleton } from '../skeleton/skeleton.component';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility';\n\nexport class WmButtonState extends BaseComponentState<WmButtonProps> {\n\n}\n\nexport default class WmButton extends BaseComponent<WmButtonProps, WmButtonState, WmButtonStyles> {\n\n constructor(props: WmButtonProps) {\n super(props, DEFAULT_CLASS, new WmButtonProps());\n }\n\n private prepareIcon({\n iconclass,\n iconurl,\n hint,\n name,\n iconsize,\n iconheight,\n iconmargin,\n iconwidth,\n }: any) {\n return iconclass || iconurl\n ? (<WmIcon\n {...this.getTestPropsForLabel('icon')}\n hint={hint}\n styles={this.styles.icon} \n name={`${name}_icon`} \n iconclass={iconclass}\n iconsize={iconsize}\n iconurl={iconurl} \n iconheight={iconheight}\n iconmargin={iconmargin}\n iconwidth={iconwidth}\n />): null;\n }\n\n private prepareBadge(props: any) {\n //@ts-ignore\n return (<Badge style={this.styles.badge}>{props.badgevalue}</Badge>);\n }\n\n public renderSkeleton(prop: WmButtonProps) {\n return createSkeleton(this.theme, this.styles.skeleton, {\n ...this.styles.root,\n width: (this.props.skeletonwidth || this.styles.root.width)as DimensionValue,\n height: (this.props.skeletonheight || this.styles.root.height) as DimensionValue\n });\n }\n\n renderWidget(props: WmButtonProps) {\n return (\n <>\n <Animatedview entryanimation={props.animation}\n style={[\n this.styles.root,\n {\n paddingTop: 0,\n paddingBottom: 0,\n paddingLeft: 0,\n paddingRight: 0,\n overflow: 'hidden'\n }\n ]}\n // accessibilityProps={{...getAccessibilityProps(\n // AccessibilityWidgetType.BUTTON,\n // props\n // )}}\n >\n {this._background}\n <Tappable\n styles={{\n paddingTop: this.styles.root.paddingTop,\n paddingBottom: this.styles.root.paddingBottom,\n paddingLeft: this.styles.root.paddingLeft,\n paddingRight: this.styles.root.paddingRight,\n height: '100%',\n justifyContent: 'center',\n }}\n rippleColor = {this.styles.root.rippleColor}\n target={this}\n {...this.getTestPropsForAction()}\n accessibilityProps={{...getAccessibilityProps(\n AccessibilityWidgetType.BUTTON,\n props\n )}}>\n <View\n style={[\n this.styles.content,\n { flexDirection: props.iconposition === 'top' ? 'column' : 'row' }\n ]}>\n {props.iconposition === 'top' && this.prepareIcon(props)}\n {props.iconposition === 'left' && this.prepareIcon(props)}\n {props.caption ? (\n <Text\n style={this.styles.text}\n {...this.getTestPropsForLabel('caption')}\n importantForAccessibility={'no'}\n // accessibilityLabel={`${props.caption}`}\n >\n {props.caption}\n </Text>\n ) : null}\n {props.iconposition === 'right' && this.prepareIcon(props)}\n </View>\n </Tappable>\n </Animatedview>\n {props.badgevalue && this.prepareBadge(props)}\n </>\n );\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;AAC5E,SAASC,KAAK,QAAQ,oBAAoB;AAE1C,OAAOC,aAAa,MAAM,gBAAgB;AAC1C,SAASC,aAAa,QAAwB,iBAAiB;AAC/D,OAAOC,MAAM,MAAM,gEAAgE;AACnF,SAASC,YAAY,QAAQ,mEAAmE;AAChG,SAASC,cAAc,QAAQ,gCAAgC;AAC/D,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,8CAA8C;AAE7G,OAAO,MAAMC,aAAa,SAASV,kBAAkB,CAAgB;AAIrE,eAAe,MAAMW,QAAQ,SAASZ,aAAa,CAA+C;EAEhGa,WAAWA,CAACC,KAAoB,EAAE;IAChC,KAAK,CAACA,KAAK,EAA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CAAC+C,YAAY,KAAK,KAAK,IAAI,IAAI,CAAC9C,WAAW,CAACD,KAAK,CAAC,EACvDA,KAAK,CAAC+C,YAAY,KAAK,MAAM,IAAI,IAAI,CAAC9C,WAAW,CAACD,KAAK,CAAC,EACxDA,KAAK,CAACgD,OAAO,gBACZjE,KAAA,CAAA4B,aAAA,CAAC3B,IAAI,EAAA4B,QAAA;MACHK,KAAK,EAAE,IAAI,CAACH,MAAM,CAACmC;IAAK,GACpB,IAAI,CAACpC,oBAAoB,CAAC,SAAS,CAAC;MACxCqC,yBAAyB,EAAE;MAC3B;IAAA,IAEClD,KAAK,CAACgD,OACH,CAAC,GACL,IAAI,EACPhD,KAAK,CAAC+C,YAAY,KAAK,OAAO,IAAI,IAAI,CAAC9C,WAAW,CAACD,KAAK,CACrD,CACE,CACE,CAAC,EACdA,KAAK,CAACmB,UAAU,IAAI,IAAI,CAACH,YAAY,CAAChB,KAAK,CAC1C,CAAC;EAEP;AACF"}
|
|
@@ -11,7 +11,8 @@ BASE_THEME.registerStyle((themeVariables, addStyle) => {
|
|
|
11
11
|
paddingLeft: 24,
|
|
12
12
|
paddingRight: 24,
|
|
13
13
|
alignSelf: 'flex-start',
|
|
14
|
-
rippleColor: themeVariables.rippleColor
|
|
14
|
+
rippleColor: themeVariables.rippleColor,
|
|
15
|
+
height: 40
|
|
15
16
|
},
|
|
16
17
|
content: {
|
|
17
18
|
flexDirection: 'row',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BASE_THEME","defineStyles","DEFAULT_CLASS","registerStyle","themeVariables","addStyle","defaultStyles","root","minHeight","borderRadius","paddingTop","paddingBottom","paddingLeft","paddingRight","alignSelf","rippleColor","content","flexDirection","alignItems","justifyContent","text","fontSize","fontFamily","baseFont","fontWeight","textAlign","textTransform","badge","backgroundColor","buttonBadgeBackgroundColor","color","buttonBadgeTextColor","position","bottom","marginRight","borderWidth","borderStyle","icon","buttonTextPadding","skeleton","width","height","opacity","getButtonStyles","bgColor","borderColor","arguments","length","undefined","linkBtnStyle","buttonLinkColor","buttonLinkTextColor","buttonWithOnlyLabel","paddingVertical","textDecorationColor","textDecorationLine","textDecorationStyle","buttonDefaultColor","buttonDefaultTextColor","buttonBorderColor","buttonInfoColor","buttonInfoTextColor","buttonPrimaryColor","buttonPrimaryTextColor","buttonSecondaryColor","buttonSecondaryTextColor","buttonDangerColor","buttonDangerTextColor","buttonSuccessColor","buttonSuccessTextColor","buttonWarningColor","buttonWarningTextColor","buttonDarkColor","buttonDarkTextColor","buttonLightColor","buttonLightTextColor","getStyle","right","marginLeft"],"sources":["button.styles.ts"],"sourcesContent":["import BASE_THEME, { AllStyle } from '@wavemaker/app-rn-runtime/styles/theme';\nimport { BaseStyles, defineStyles } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { WmIconStyles } from '../icon/icon.styles';\nimport { WmSkeletonStyles } from '../skeleton/skeleton.styles';\n\nexport type WmButtonStyles = BaseStyles & {\n content: AllStyle,\n badge: AllStyle,\n icon: WmIconStyles,\n skeleton: WmSkeletonStyles\n};\n\nexport const DEFAULT_CLASS = 'app-button';\nBASE_THEME.registerStyle((themeVariables, addStyle) => {\n const defaultStyles: WmButtonStyles = defineStyles<WmButtonStyles>({\n root: {\n minHeight: 40,\n borderRadius: 32,\n paddingTop: 12,\n paddingBottom: 12,\n paddingLeft: 24,\n paddingRight: 24,\n alignSelf: 'flex-start',\n rippleColor: themeVariables.rippleColor\n },\n content: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center'\n },\n text: {\n fontSize: 14,\n fontFamily: themeVariables.baseFont,\n fontWeight: '500',\n textAlign: 'center',\n textTransform: 'capitalize',\n },\n badge: {\n backgroundColor: themeVariables.buttonBadgeBackgroundColor,\n color: themeVariables.buttonBadgeTextColor,\n alignSelf: 'flex-end',\n position: 'relative',\n bottom: 60 ,\n marginRight: 18,\n borderWidth: 1,\n borderStyle: 'solid',\n },\n icon: {\n root : {\n alignSelf: 'auto',\n paddingLeft: -8,\n paddingRight: -8\n },\n text: {\n paddingRight: themeVariables.buttonTextPadding,\n fontSize: 16\n }\n } as WmIconStyles,\n skeleton: {\n root: {\n width: 96,\n height: 48,\n borderRadius: 4\n }\n } as WmSkeletonStyles\n });\n\n addStyle(DEFAULT_CLASS, '', defaultStyles);\n addStyle(DEFAULT_CLASS + '-disabled', '', {\n root : {\n opacity: 0.5\n }\n });\n\n const getButtonStyles = (bgColor: string, color: string, borderColor = bgColor) => {\n return {\n root: {\n borderWidth: 1,\n borderColor: borderColor,\n borderStyle: 'solid',\n backgroundColor: bgColor\n },\n text: {\n color: color\n },\n badge: {\n backgroundColor: color,\n color: bgColor,\n borderColor: bgColor\n },\n icon: {\n text: {\n color: color\n }\n }\n } as WmButtonStyles;\n }\n\n const linkBtnStyle = getButtonStyles(themeVariables.buttonLinkColor, themeVariables.buttonLinkTextColor );\nconst buttonWithOnlyLabel = getButtonStyles(themeVariables.buttonLinkColor, themeVariables.buttonLinkTextColor );\n\n linkBtnStyle.root.paddingVertical = 4;\n linkBtnStyle.text.textDecorationColor = themeVariables.buttonLinkTextColor;\n linkBtnStyle.text.textDecorationLine = 'underline';\n linkBtnStyle.text.textDecorationStyle = 'solid';\n\n addStyle('btn-default', '', getButtonStyles(themeVariables.buttonDefaultColor, themeVariables.buttonDefaultTextColor, themeVariables.buttonBorderColor));\n addStyle('btn-info', '', getButtonStyles(themeVariables.buttonInfoColor, themeVariables.buttonInfoTextColor));\n addStyle('btn-primary', '', getButtonStyles(themeVariables.buttonPrimaryColor, themeVariables.buttonPrimaryTextColor));\n addStyle('btn-secondary', '', getButtonStyles(themeVariables.buttonSecondaryColor, themeVariables.buttonSecondaryTextColor, themeVariables.buttonSecondaryTextColor));\n addStyle('btn-danger', '', getButtonStyles(themeVariables.buttonDangerColor, themeVariables.buttonDangerTextColor));\n addStyle('btn-success', '', getButtonStyles(themeVariables.buttonSuccessColor, themeVariables.buttonSuccessTextColor));\n addStyle('btn-warning', '', getButtonStyles(themeVariables.buttonWarningColor, themeVariables.buttonWarningTextColor));\n addStyle('btn-link', '', linkBtnStyle);\n addStyle('btn-only-label', '', buttonWithOnlyLabel);\n addStyle('btn-dark', '', getButtonStyles(themeVariables.buttonDarkColor, themeVariables.buttonDarkTextColor));\n addStyle('btn-light', '', getButtonStyles(themeVariables.buttonLightColor, themeVariables.buttonLightTextColor));\n addStyle('fab-btn', 'btn-primary', {\n root : {\n ...BASE_THEME.getStyle('elevate2').root,\n position: 'fixed' as any,\n bottom: 160,\n right: 48,\n width: 56,\n height: 56,\n borderRadius: 56,\n justifyContent: 'center',\n alignItems: 'center'\n },\n text: {\n marginLeft: 0,\n marginRight: 0\n },\n icon: {\n icon: {\n fontSize: 24\n }\n } as WmIconStyles\n } as WmButtonStyles);\n addStyle('mini-fab-btn', 'fab-btn', {\n root : {\n width: 40,\n height: 40\n }\n } as WmButtonStyles);\n});\n"],"mappings":"AAAA,OAAOA,UAAU,MAAoB,wCAAwC;AAC7E,SAAqBC,YAAY,QAAQ,+CAA+C;AAWxF,OAAO,MAAMC,aAAa,GAAG,YAAY;AACzCF,UAAU,CAACG,aAAa,CAAC,CAACC,cAAc,EAAEC,QAAQ,KAAK;EACrD,MAAMC,aAA6B,GAAGL,YAAY,CAAiB;IAC/DM,IAAI,EAAE;MACFC,SAAS,EAAE,EAAE;MACbC,YAAY,EAAE,EAAE;MAChBC,UAAU,EAAE,EAAE;MACdC,aAAa,EAAE,EAAE;MACjBC,WAAW,EAAE,EAAE;MACfC,YAAY,EAAE,EAAE;MAChBC,SAAS,EAAE,YAAY;MACvBC,WAAW,EAAEX,cAAc,CAACW;IAChC,CAAC;IACDC,OAAO,EAAE;MACPC,aAAa,EAAE,KAAK;MACpBC,UAAU,EAAE,QAAQ;MACpBC,cAAc,EAAE;IAClB,CAAC;IACDC,IAAI,EAAE;MACJC,QAAQ,EAAE,EAAE;MACZC,UAAU,EAAElB,cAAc,CAACmB,QAAQ;MACnCC,UAAU,EAAE,KAAK;MACjBC,SAAS,EA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ClCE,IAAI,EAAG;MACLiC,KAAK,EAAE,EAAE;MACTC,MAAM,EAAE;IACV;EACF,CAAmB,CAAC;AACtB,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"names":["BASE_THEME","defineStyles","DEFAULT_CLASS","registerStyle","themeVariables","addStyle","defaultStyles","root","minHeight","borderRadius","paddingTop","paddingBottom","paddingLeft","paddingRight","alignSelf","rippleColor","height","content","flexDirection","alignItems","justifyContent","text","fontSize","fontFamily","baseFont","fontWeight","textAlign","textTransform","badge","backgroundColor","buttonBadgeBackgroundColor","color","buttonBadgeTextColor","position","bottom","marginRight","borderWidth","borderStyle","icon","buttonTextPadding","skeleton","width","opacity","getButtonStyles","bgColor","borderColor","arguments","length","undefined","linkBtnStyle","buttonLinkColor","buttonLinkTextColor","buttonWithOnlyLabel","paddingVertical","textDecorationColor","textDecorationLine","textDecorationStyle","buttonDefaultColor","buttonDefaultTextColor","buttonBorderColor","buttonInfoColor","buttonInfoTextColor","buttonPrimaryColor","buttonPrimaryTextColor","buttonSecondaryColor","buttonSecondaryTextColor","buttonDangerColor","buttonDangerTextColor","buttonSuccessColor","buttonSuccessTextColor","buttonWarningColor","buttonWarningTextColor","buttonDarkColor","buttonDarkTextColor","buttonLightColor","buttonLightTextColor","getStyle","right","marginLeft"],"sources":["button.styles.ts"],"sourcesContent":["import BASE_THEME, { AllStyle } from '@wavemaker/app-rn-runtime/styles/theme';\nimport { BaseStyles, defineStyles } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { WmIconStyles } from '../icon/icon.styles';\nimport { WmSkeletonStyles } from '../skeleton/skeleton.styles';\n\nexport type WmButtonStyles = BaseStyles & {\n content: AllStyle,\n badge: AllStyle,\n icon: WmIconStyles,\n skeleton: WmSkeletonStyles\n};\n\nexport const DEFAULT_CLASS = 'app-button';\nBASE_THEME.registerStyle((themeVariables, addStyle) => {\n const defaultStyles: WmButtonStyles = defineStyles<WmButtonStyles>({\n root: {\n minHeight: 40,\n borderRadius: 32,\n paddingTop: 12,\n paddingBottom: 12,\n paddingLeft: 24,\n paddingRight: 24,\n alignSelf: 'flex-start',\n rippleColor: themeVariables.rippleColor,\n height: 40\n },\n content: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center'\n },\n text: {\n fontSize: 14,\n fontFamily: themeVariables.baseFont,\n fontWeight: '500',\n textAlign: 'center',\n textTransform: 'capitalize',\n },\n badge: {\n backgroundColor: themeVariables.buttonBadgeBackgroundColor,\n color: themeVariables.buttonBadgeTextColor,\n alignSelf: 'flex-end',\n position: 'relative',\n bottom: 60 ,\n marginRight: 18,\n borderWidth: 1,\n borderStyle: 'solid',\n },\n icon: {\n root : {\n alignSelf: 'auto',\n paddingLeft: -8,\n paddingRight: -8\n },\n text: {\n paddingRight: themeVariables.buttonTextPadding,\n fontSize: 16\n }\n } as WmIconStyles,\n skeleton: {\n root: {\n width: 96,\n height: 48,\n borderRadius: 4\n }\n } as WmSkeletonStyles\n });\n\n addStyle(DEFAULT_CLASS, '', defaultStyles);\n addStyle(DEFAULT_CLASS + '-disabled', '', {\n root : {\n opacity: 0.5\n }\n });\n\n const getButtonStyles = (bgColor: string, color: string, borderColor = bgColor) => {\n return {\n root: {\n borderWidth: 1,\n borderColor: borderColor,\n borderStyle: 'solid',\n backgroundColor: bgColor\n },\n text: {\n color: color\n },\n badge: {\n backgroundColor: color,\n color: bgColor,\n borderColor: bgColor\n },\n icon: {\n text: {\n color: color\n }\n }\n } as WmButtonStyles;\n }\n\n const linkBtnStyle = getButtonStyles(themeVariables.buttonLinkColor, themeVariables.buttonLinkTextColor );\nconst buttonWithOnlyLabel = getButtonStyles(themeVariables.buttonLinkColor, themeVariables.buttonLinkTextColor );\n\n linkBtnStyle.root.paddingVertical = 4;\n linkBtnStyle.text.textDecorationColor = themeVariables.buttonLinkTextColor;\n linkBtnStyle.text.textDecorationLine = 'underline';\n linkBtnStyle.text.textDecorationStyle = 'solid';\n\n addStyle('btn-default', '', getButtonStyles(themeVariables.buttonDefaultColor, themeVariables.buttonDefaultTextColor, themeVariables.buttonBorderColor));\n addStyle('btn-info', '', getButtonStyles(themeVariables.buttonInfoColor, themeVariables.buttonInfoTextColor));\n addStyle('btn-primary', '', getButtonStyles(themeVariables.buttonPrimaryColor, themeVariables.buttonPrimaryTextColor));\n addStyle('btn-secondary', '', getButtonStyles(themeVariables.buttonSecondaryColor, themeVariables.buttonSecondaryTextColor, themeVariables.buttonSecondaryTextColor));\n addStyle('btn-danger', '', getButtonStyles(themeVariables.buttonDangerColor, themeVariables.buttonDangerTextColor));\n addStyle('btn-success', '', getButtonStyles(themeVariables.buttonSuccessColor, themeVariables.buttonSuccessTextColor));\n addStyle('btn-warning', '', getButtonStyles(themeVariables.buttonWarningColor, themeVariables.buttonWarningTextColor));\n addStyle('btn-link', '', linkBtnStyle);\n addStyle('btn-only-label', '', buttonWithOnlyLabel);\n addStyle('btn-dark', '', getButtonStyles(themeVariables.buttonDarkColor, themeVariables.buttonDarkTextColor));\n addStyle('btn-light', '', getButtonStyles(themeVariables.buttonLightColor, themeVariables.buttonLightTextColor));\n addStyle('fab-btn', 'btn-primary', {\n root : {\n ...BASE_THEME.getStyle('elevate2').root,\n position: 'fixed' as any,\n bottom: 160,\n right: 48,\n width: 56,\n height: 56,\n borderRadius: 56,\n justifyContent: 'center',\n alignItems: 'center'\n },\n text: {\n marginLeft: 0,\n marginRight: 0\n },\n icon: {\n icon: {\n fontSize: 24\n }\n } as WmIconStyles\n } as WmButtonStyles);\n addStyle('mini-fab-btn', 'fab-btn', {\n root : {\n width: 40,\n height: 40\n }\n } as WmButtonStyles);\n});\n"],"mappings":"AAAA,OAAOA,UAAU,MAAoB,wCAAwC;AAC7E,SAAqBC,YAAY,QAAQ,+CAA+C;AAWxF,OAAO,MAAMC,aAAa,GAAG,YAAY;AACzCF,UAAU,CAACG,aAAa,CAAC,CAACC,cAAc,EAAEC,QAAQ,KAAK;EACrD,MAAMC,aAA6B,GAAGL,YAAY,CAAiB;IAC/DM,IAAI,EAAE;M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AAU,CAAC4E,QAAQ,CAAC,UAAU,CAAC,CAACrE,IAAI;MACvC0B,QAAQ,EAAE,OAAc;MACxBC,MAAM,EAAE,GAAG;MACX2C,KAAK,EAAE,EAAE;MACTpC,KAAK,EAAE,EAAE;MACTzB,MAAM,EAAE,EAAE;MACVP,YAAY,EAAE,EAAE;MAChBW,cAAc,EAAE,QAAQ;MACxBD,UAAU,EAAE;IACd,CAAC;IACDE,IAAI,EAAE;MACJyD,UAAU,EAAE,CAAC;MACb3C,WAAW,EAAE;IACf,CAAC;IACDG,IAAI,EAAE;MACJA,IAAI,EAAE;QACJhB,QAAQ,EAAE;MACZ;IACF;EACF,CAAmB,CAAC;EACpBjB,QAAQ,CAAC,cAAc,EAAE,SAAS,EAAE;IAClCE,IAAI,EAAG;MACLkC,KAAK,EAAE,EAAE;MACTzB,MAAM,EAAE;IACV;EACF,CAAmB,CAAC;AACtB,CAAC,CAAC"}
|
|
@@ -115,7 +115,7 @@ export default class WmLabel extends BaseComponent {
|
|
|
115
115
|
}, this.state.parts.length <= 1 ? this.getTestPropsForLabel('caption') : {}, getAccessibilityProps(AccessibilityWidgetType.LABEL, props), {
|
|
116
116
|
numberOfLines: props.nooflines,
|
|
117
117
|
ellipsizeMode: "tail"
|
|
118
|
-
}), ((_this$state$parts = this.state.parts) === null || _this$state$parts === void 0 ? void 0 : _this$state$parts.length) === 1 ?
|
|
118
|
+
}), ((_this$state$parts = this.state.parts) === null || _this$state$parts === void 0 ? void 0 : _this$state$parts.length) === 1 ? this.state.props.caption : (_this$state$parts2 = this.state.parts) === null || _this$state$parts2 === void 0 ? void 0 : _this$state$parts2.map((part, index) => {
|
|
119
119
|
const isLink = !isNil(part.link);
|
|
120
120
|
return /*#__PURE__*/React.createElement(Text, _extends({
|
|
121
121
|
key: `part_${index}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Text","View","BaseComponent","BaseComponentState","Tappable","NavigationServiceConsumer","AccessibilityWidgetType","getAccessibilityProps","WmLabelProps","DEFAULT_CLASS","isNil","toString","Animatedview","createSkeleton","WmLabelState","constructor","arguments","_defineProperty","WmLabel","props","getAsterisk","createElement","style","styles","asterisk","onPropertyChange","name","$new","$old","updateState","parts","parseCaption","getMultilineSkeleton","width","height","borderRadius","marginBottom","theme","skeleton","caption","replace","pattern","linkRegex","captionSplit","split","i","length","isLink","test","part","isNextTextALink","text","link","push","renderSkeleton","_this$styles$root","_this$styles$root2","skeletonWidth","skeletonwidth","root","skeletonHeight","skeletonheight","fontSize","multilineskeleton","renderWidget","linkStyles","mergeStyle","entryanimation","animation","_background","navigationService","_this$state$parts","_this$state$parts2","target","_extends","state","flexWrap","textAlign","getTestPropsForLabel","LABEL","numberOfLines","nooflines","ellipsizeMode","map","index","key","isValid","color","selectable","userSelect","onPress","startsWith","openUrl","eventName","substring","invokeEventCallback","proxy","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';\nimport NavigationService, { NavigationServiceConsumer } from '@wavemaker/app-rn-runtime/core/navigation.service';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility';\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';\n\ntype PartType = {\n text?: string,\n link?: string,\n};\n\nexport class WmLabelState extends BaseComponentState<WmLabelProps> {\n parts: PartType[] = []\n}\n\nexport default class WmLabel extends BaseComponent<WmLabelProps, WmLabelState, WmLabelStyles> {\n\n constructor(props: WmLabelProps) {\n super(props, DEFAULT_CLASS, new WmLabelProps(), new WmLabelState());\n }\n\n private getAsterisk () {\n return <Text style={this.styles.asterisk}>*</Text>;\n }\n\n public onPropertyChange(name: string, $new: any, $old: any): void {\n super.onPropertyChange(name, $new, $old);\n\n switch(name) {\n case \"caption\":\n this.updateState({\n parts: this.parseCaption($new)\n } as WmLabelState);\n break;\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 parseCaption(caption: string) {\n if (!caption) {\n return [];\n }\n caption += '';\n caption = caption.replace(/\\s*\\(\\s*\\$event,\\s*\\$widget\\s*\\)\\s*/, '');\n caption = caption.replace(/\\(\\s*\\)/, '(#/__EMPTY__)');\n const pattern = /\\[([^\\]]+)\\]\\(([^)]*)\\)/g;\n const linkRegex = /^(((http|https):\\/\\/)|javascript:|#).+$/;\n const captionSplit = caption.split(pattern);\n\n let parts = [];\n\n for (let i = 0; i < captionSplit.length; i++) {\n const isLink = linkRegex.test(captionSplit[i]);\n let part: PartType = {};\n \n const isNextTextALink = linkRegex.test(captionSplit[i + 1]);\n if (isLink) {\n part.text = captionSplit[i - 1] ?? '';\n part.link = captionSplit[i] === '#/__EMPTY__' ? '' : captionSplit[i];\n } else {\n part.text = isNextTextALink ? \"\" : captionSplit[i];\n };\n\n if (part.text) {\n parts.push(part);\n }\n }\n\n return parts;\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 const linkStyles = this.theme.mergeStyle({text: this.styles.text}, this.styles.link);\n return !isNil(props.caption) ? (\n <Animatedview entryanimation={props.animation} style={this.styles.root}>\n {this._background}\n <NavigationServiceConsumer>\n {(navigationService: NavigationService) => {\n return (<Tappable target={this}>\n <Text style={ this.state.parts.length <= 1 ? this.styles.text : {flexWrap: \"wrap\", textAlign: this.styles.text.textAlign}}\n {...this.state.parts.length <= 1 ? this.getTestPropsForLabel('caption') : {}}\n {...getAccessibilityProps(AccessibilityWidgetType.LABEL, props)}\n numberOfLines={props.nooflines} ellipsizeMode=\"tail\">\n {this.state.parts?.length === 1 ? toString(this.state.props.caption) : this.state.parts?.map((part, index) => {\n const isLink = !isNil(part.link);\n return (\n <Text\n key={`part_${index}`}\n style={[\n this.styles.text,\n isLink ? this.styles.link.text : null,\n props.isValid ? null : { color: 'red'}\n ]}\n {...this.getTestPropsForLabel(isLink ? `link_${index}` : `caption_${index}`)}\n selectable={this.styles.text.userSelect === 'text'}\n onPress={() => {\n if (part.link) { \n if (part.link.startsWith('http:')\n || part.link.startsWith('https:')\n || part.link.startsWith('#')) {\n navigationService.openUrl(part.link, '_blank');\n } else if (part.link.startsWith('javascript:')) {\n const eventName = part.link.substring(11);\n this.invokeEventCallback(eventName, [null, this.proxy]);\n }\n }\n this.invokeEventCallback('onTap', [null, this.proxy]);\n }}\n // {...getAccessibilityProps(AccessibilityWidgetType.LABEL, props)}\n >\n {toString(part.text)}\n {props.required && this.getAsterisk()}\n </Text>\n );\n })}\n </Text>\n </Tappable>)}}\n </NavigationServiceConsumer>\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;AAC5E,SA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ACzD;YACF;YACA,IAAI,CAACD,mBAAmB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,CAACC,KAAK,CAAC,CAAC;UACvD;UACA;QAAA,IAECrF,QAAQ,CAACsC,IAAI,CAACE,IAAI,CAAC,EACnBhC,KAAK,CAAC8E,QAAQ,IAAI,IAAI,CAAC7E,WAAW,CAAC,CAChC,CAAC;MAEX,CAAC,CACG,CACE,CAAC;IAAC,CACa,CACf,CAAC,GACb,IAAI;EACV;AACF"}
|
|
1
|
+
{"version":3,"names":["React","Text","View","BaseComponent","BaseComponentState","Tappable","NavigationServiceConsumer","AccessibilityWidgetType","getAccessibilityProps","WmLabelProps","DEFAULT_CLASS","isNil","toString","Animatedview","createSkeleton","WmLabelState","constructor","arguments","_defineProperty","WmLabel","props","getAsterisk","createElement","style","styles","asterisk","onPropertyChange","name","$new","$old","updateState","parts","parseCaption","getMultilineSkeleton","width","height","borderRadius","marginBottom","theme","skeleton","caption","replace","pattern","linkRegex","captionSplit","split","i","length","isLink","test","part","isNextTextALink","text","link","push","renderSkeleton","_this$styles$root","_this$styles$root2","skeletonWidth","skeletonwidth","root","skeletonHeight","skeletonheight","fontSize","multilineskeleton","renderWidget","linkStyles","mergeStyle","entryanimation","animation","_background","navigationService","_this$state$parts","_this$state$parts2","target","_extends","state","flexWrap","textAlign","getTestPropsForLabel","LABEL","numberOfLines","nooflines","ellipsizeMode","map","index","key","isValid","color","selectable","userSelect","onPress","startsWith","openUrl","eventName","substring","invokeEventCallback","proxy","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';\nimport NavigationService, { NavigationServiceConsumer } from '@wavemaker/app-rn-runtime/core/navigation.service';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility';\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';\n\ntype PartType = {\n text?: string,\n link?: string,\n};\n\nexport class WmLabelState extends BaseComponentState<WmLabelProps> {\n parts: PartType[] = []\n}\n\nexport default class WmLabel extends BaseComponent<WmLabelProps, WmLabelState, WmLabelStyles> {\n\n constructor(props: WmLabelProps) {\n super(props, DEFAULT_CLASS, new WmLabelProps(), new WmLabelState());\n }\n\n private getAsterisk () {\n return <Text style={this.styles.asterisk}>*</Text>;\n }\n\n public onPropertyChange(name: string, $new: any, $old: any): void {\n super.onPropertyChange(name, $new, $old);\n\n switch(name) {\n case \"caption\":\n this.updateState({\n parts: this.parseCaption($new)\n } as WmLabelState);\n break;\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 parseCaption(caption: string) {\n if (!caption) {\n return [];\n }\n caption += '';\n caption = caption.replace(/\\s*\\(\\s*\\$event,\\s*\\$widget\\s*\\)\\s*/, '');\n caption = caption.replace(/\\(\\s*\\)/, '(#/__EMPTY__)');\n const pattern = /\\[([^\\]]+)\\]\\(([^)]*)\\)/g;\n const linkRegex = /^(((http|https):\\/\\/)|javascript:|#).+$/;\n const captionSplit = caption.split(pattern);\n\n let parts = [];\n\n for (let i = 0; i < captionSplit.length; i++) {\n const isLink = linkRegex.test(captionSplit[i]);\n let part: PartType = {};\n \n const isNextTextALink = linkRegex.test(captionSplit[i + 1]);\n if (isLink) {\n part.text = captionSplit[i - 1] ?? '';\n part.link = captionSplit[i] === '#/__EMPTY__' ? '' : captionSplit[i];\n } else {\n part.text = isNextTextALink ? \"\" : captionSplit[i];\n };\n\n if (part.text) {\n parts.push(part);\n }\n }\n\n return parts;\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 const linkStyles = this.theme.mergeStyle({text: this.styles.text}, this.styles.link);\n return !isNil(props.caption) ? (\n <Animatedview entryanimation={props.animation} style={this.styles.root}>\n {this._background}\n <NavigationServiceConsumer>\n {(navigationService: NavigationService) => {\n return (<Tappable target={this}>\n <Text style={ this.state.parts.length <= 1 ? this.styles.text : {flexWrap: \"wrap\", textAlign: this.styles.text.textAlign}}\n {...this.state.parts.length <= 1 ? this.getTestPropsForLabel('caption') : {}}\n {...getAccessibilityProps(AccessibilityWidgetType.LABEL, props)}\n numberOfLines={props.nooflines} ellipsizeMode=\"tail\">\n {this.state.parts?.length === 1 ? this.state.props.caption : this.state.parts?.map((part, index) => {\n const isLink = !isNil(part.link);\n return (\n <Text\n key={`part_${index}`}\n style={[\n this.styles.text,\n isLink ? this.styles.link.text : null,\n props.isValid ? null : { color: 'red'}\n ]}\n {...this.getTestPropsForLabel(isLink ? `link_${index}` : `caption_${index}`)}\n selectable={this.styles.text.userSelect === 'text'}\n onPress={() => {\n if (part.link) { \n if (part.link.startsWith('http:')\n || part.link.startsWith('https:')\n || part.link.startsWith('#')) {\n navigationService.openUrl(part.link, '_blank');\n } else if (part.link.startsWith('javascript:')) {\n const eventName = part.link.substring(11);\n this.invokeEventCallback(eventName, [null, this.proxy]);\n }\n }\n this.invokeEventCallback('onTap', [null, this.proxy]);\n }}\n // {...getAccessibilityProps(AccessibilityWidgetType.LABEL, props)}\n >\n {toString(part.text)}\n {props.required && this.getAsterisk()}\n </Text>\n );\n })}\n </Text>\n </Tappable>)}}\n </NavigationServiceConsumer>\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;AAC5E,SAA4BC,yBAAyB,QAAQ,mDAAmD;AAChH,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,8CAA8C;AAE7G,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;AAO3E,OAAO,MAAMC,YAAY,SAASX,kBAAkB,CAAe;EAAAY,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA,gBAC7C,EAAE;EAAA;AACxB;AAEA,eAAe,MAAMC,OAAO,SAAShB,aAAa,CAA4C;EAE5Fa,WAAWA,CAACI,KAAmB,EAAE;IAC/B,KAAK,CAACA,KAAK,EAAEV,aAAa,EAAE,IAAID,YAAY,CAAC,CAAC,EAAE,IAAIM,YAAY,CAAC,CAAC,CAAC;EACrE;EAEQM,WAAWA,CAAA,EAAI;IACrB,oBAAOrB,KAAA,CAAAsB,aAAA,CAACrB,IAAI;MAACsB,KAAK,EAAE,IAAI,CAACC,MAAM,CAACC;IAAS,GAAC,GAAO,CAAC;EACpD;EAEOC,gBAAgBA,CAACC,IAAY,EAAEC,IAAS,EAAEC,IAAS,EAAQ;IAChE,KAAK,CAACH,gBAAgB,CAACC,IAAI,EAA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,IAAI,CAACuC,UAAU,CAAC,GAAG,CAAC,EAAE;gBAC9BrB,iBAAiB,CAACsB,OAAO,CAAC3C,IAAI,CAACG,IAAI,EAAE,QAAQ,CAAC;cAChD,CAAC,MAAM,IAAIH,IAAI,CAACG,IAAI,CAACuC,UAAU,CAAC,aAAa,CAAC,EAAE;gBAC9C,MAAME,SAAS,GAAG5C,IAAI,CAACG,IAAI,CAAC0C,SAAS,CAAC,EAAE,CAAC;gBACzC,IAAI,CAACC,mBAAmB,CAACF,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,CAACG,KAAK,CAAC,CAAC;cACzD;YACF;YACA,IAAI,CAACD,mBAAmB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,CAACC,KAAK,CAAC,CAAC;UACvD;UACA;QAAA,IAECrF,QAAQ,CAACsC,IAAI,CAACE,IAAI,CAAC,EACnBhC,KAAK,CAAC8E,QAAQ,IAAI,IAAI,CAAC7E,WAAW,CAAC,CAChC,CAAC;MAEX,CAAC,CACG,CACE,CAAC;IAAC,CACa,CACf,CAAC,GACb,IAAI;EACV;AACF"}
|
|
@@ -33,23 +33,12 @@ export default class WmAreaChart extends BaseChartComponent {
|
|
|
33
33
|
let value = data.data[data.index].y;
|
|
34
34
|
let label = this.state.xaxisDatakeyArr[data.datum.x];
|
|
35
35
|
let selectedItem = this.props.dataset[data.index];
|
|
36
|
-
const nativeEvent = event.nativeEvent;
|
|
37
|
-
this.setTooltipPosition(nativeEvent);
|
|
38
36
|
let selectedChartItem = [{
|
|
39
37
|
series: 0,
|
|
40
38
|
x: data.index,
|
|
41
39
|
y: value,
|
|
42
40
|
_dataObj: selectedItem
|
|
43
41
|
}, data.index];
|
|
44
|
-
this.updateState({
|
|
45
|
-
tooltipXaxis: label,
|
|
46
|
-
tooltipYaxis: value,
|
|
47
|
-
isTooltipOpen: true,
|
|
48
|
-
selectedItem: {
|
|
49
|
-
...selectedItem,
|
|
50
|
-
index: data.index
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
42
|
this.invokeEventCallback('onSelect', [event.nativeEvent, this.proxy, selectedItem, selectedChartItem]);
|
|
54
43
|
}
|
|
55
44
|
renderWidget(props) {
|
|
@@ -70,7 +59,7 @@ export default class WmAreaChart extends BaseChartComponent {
|
|
|
70
59
|
return /*#__PURE__*/React.createElement(View, _extends({}, getAccessibilityProps(AccessibilityWidgetType.LINECHART, props), {
|
|
71
60
|
style: this.styles.root,
|
|
72
61
|
onLayout: this.onViewLayoutChange.bind(this)
|
|
73
|
-
}),
|
|
62
|
+
}), /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, {
|
|
74
63
|
style: {
|
|
75
64
|
flexDirection: 'row',
|
|
76
65
|
alignItems: 'center'
|
|
@@ -92,7 +81,8 @@ export default class WmAreaChart extends BaseChartComponent {
|
|
|
92
81
|
left: props.offsetleft,
|
|
93
82
|
right: props.offsetright
|
|
94
83
|
},
|
|
95
|
-
minDomain: mindomain
|
|
84
|
+
minDomain: mindomain,
|
|
85
|
+
containerComponent: this.getTooltip(props)
|
|
96
86
|
}, this.getLegendView(), this.getXaxis(), this.getYAxis(), /*#__PURE__*/React.createElement(VictoryStack, null, this.state.data.map((d, i) => {
|
|
97
87
|
return /*#__PURE__*/React.createElement(VictoryGroup, {
|
|
98
88
|
key: props.name + '_area_group_' + i
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Color","View","Text","Platform","Defs","LinearGradient","Stop","VictoryArea","VictoryChart","VictoryStack","VictoryScatter","VictoryGroup","WmAreaChartProps","DEFAULT_CLASS","BaseChartComponent","BaseChartComponentState","WmIcon","isNumber","AccessibilityWidgetType","getAccessibilityProps","WmAreaChartState","constructor","arguments","_defineProperty","WmAreaChart","props","e","viewWidth","nativeEvent","layout","width","updateState","chartWidth","onSelect","event","data","value","index","y","label","state","xaxisDatakeyArr","datum","x","selectedItem","dataset","setTooltipPosition","selectedChartItem","series","_dataObj","tooltipXaxis","tooltipYaxis","isTooltipOpen","invokeEventCallback","proxy","renderWidget","_this$state$data","length","mindomain","xdomain","chartMinX","undefined","ydomain","chartMinY","chartName","name","gradientStop","chartMaxY","createElement","_extends","LINECHART","style","styles","root","onLayout","onViewLayoutChange","bind","getTooltip","flexDirection","alignItems","iconclass","icon","title","subHeading","subheading","theme","height","padding","top","offsettop","bottom","offsetbottom","left","offsetleft","right","offsetright","minDomain","getLegendView","getXaxis","getYAxis","map","d","i","key","id","x1","y1","x2","y2","offset","stopColor","colors","lighten","rgb","toString","interpolation","fill","stroke","strokeWidth","linethickness","isRTL","toReversed","size","highlightpoints","opacity","events","target","eventHandlers","OS","onClick","onPress"],"sources":["area-chart.component.tsx"],"sourcesContent":["import React from 'react';\nimport Color from \"color\";\nimport { LayoutChangeEvent, View, Text, Platform } 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 WmIcon from \"@wavemaker/app-rn-runtime/components/basic/icon/icon.component\";\n\nimport ThemeVariables from '@wavemaker/app-rn-runtime/styles/theme.variables';\nimport { isNil, isNumber } from 'lodash-es';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility'; \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 onSelect(event: any, data: any){\n let value = data.data[data.index].y;\n let label = this.state.xaxisDatakeyArr[data.datum.x];\n let selectedItem = this.props.dataset[data.index];\n const nativeEvent = event.nativeEvent;\n this.setTooltipPosition(nativeEvent);\n let selectedChartItem = [{series: 0, x: data.index, y: value,_dataObj: selectedItem},data.index];\n this.updateState({\n tooltipXaxis: label,\n tooltipYaxis: value,\n isTooltipOpen: true,\n selectedItem: {...selectedItem, index: data.index},\n } as WmAreaChartState)\n this.invokeEventCallback('onSelect', [event.nativeEvent, this.proxy, selectedItem, selectedChartItem ]);\n }\n\n renderWidget(props: WmAreaChartProps) {\n this.invokeEventCallback('onBeforerender', [this.proxy, null]);\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 {...getAccessibilityProps(AccessibilityWidgetType.LINECHART, props)}\n style={this.styles.root}\n onLayout={this.onViewLayoutChange.bind(this)}\n >\n {this.getTooltip()}\n <View>\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 {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: props.offsettop, bottom: props.offsetbottom, left: props.offsetleft, right: props.offsetright }}\n minDomain={mindomain}\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 name={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={this.isRTL?d.toReversed():d}\n />\n <VictoryScatter\n size={5}\n key={props.name + '_scatter' + i}\n style={{\n data: props.highlightpoints ? {fill: this.state.colors[i], opacity: 0.8}:{opacity: 0}\n }} \n data={this.isRTL?d.toReversed():d}\n events={[{\n target: 'data',\n eventHandlers: Platform.OS == \"web\" ? {\n onClick: this.onSelect.bind(this)\n }:{\n onPress: this.onSelect.bind(this)\n }\n }]}\n />\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,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,cAAc;AACtE,SAASC,IAAI,EAAEC,cAAc,EAAEC,IAAI,QAAa,kBAAkB;AAClE,SAASC,WAAW,EAAeC,YAAY,EAAiBC,YAAY,EAAEC,cAAc,EAAEC,YAAY,QAAQ,gBAAgB;AAElI,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,SAASC,aAAa,QAA2B,qBAAqB;AACtE,SACEC,kBAAkB,EAClBC,uBAAuB,QAClB,gEAA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E,IAAI,CAAChG,QAAQ,CAAC2C,IAAI,CAAC,IAAI;UAClC,CAAC,GAAC;YACAsD,OAAO,EAAE,IAAI,CAACjG,QAAQ,CAAC2C,IAAI,CAAC,IAAI;UAClC;QACF,CAAC;MAAE,CACF,CACO,CAAC;IACjB,CAAC,CAEW,CACF,CAAC,GAEjB,IACE,CAAC;EACT;AACF"}
|
|
1
|
+
{"version":3,"names":["React","Color","View","Text","Platform","Defs","LinearGradient","Stop","VictoryArea","VictoryChart","VictoryStack","VictoryScatter","VictoryGroup","WmAreaChartProps","DEFAULT_CLASS","BaseChartComponent","BaseChartComponentState","WmIcon","isNumber","AccessibilityWidgetType","getAccessibilityProps","WmAreaChartState","constructor","arguments","_defineProperty","WmAreaChart","props","e","viewWidth","nativeEvent","layout","width","updateState","chartWidth","onSelect","event","data","value","index","y","label","state","xaxisDatakeyArr","datum","x","selectedItem","dataset","selectedChartItem","series","_dataObj","invokeEventCallback","proxy","renderWidget","_this$state$data","length","mindomain","xdomain","chartMinX","undefined","ydomain","chartMinY","chartName","name","gradientStop","chartMaxY","createElement","_extends","LINECHART","style","styles","root","onLayout","onViewLayoutChange","bind","flexDirection","alignItems","iconclass","icon","title","subHeading","subheading","theme","height","padding","top","offsettop","bottom","offsetbottom","left","offsetleft","right","offsetright","minDomain","containerComponent","getTooltip","getLegendView","getXaxis","getYAxis","map","d","i","key","id","x1","y1","x2","y2","offset","stopColor","colors","lighten","rgb","toString","interpolation","fill","stroke","strokeWidth","linethickness","isRTL","toReversed","size","highlightpoints","opacity","events","target","eventHandlers","OS","onClick","onPress"],"sources":["area-chart.component.tsx"],"sourcesContent":["import React from 'react';\nimport Color from \"color\";\nimport { LayoutChangeEvent, View, Text, Platform } 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 WmIcon from \"@wavemaker/app-rn-runtime/components/basic/icon/icon.component\";\n\nimport ThemeVariables from '@wavemaker/app-rn-runtime/styles/theme.variables';\nimport { isNil, isNumber } from 'lodash-es';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility'; \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 onSelect(event: any, data: any){\n let value = data.data[data.index].y;\n let label = this.state.xaxisDatakeyArr[data.datum.x];\n let selectedItem = this.props.dataset[data.index];\n let selectedChartItem = [{series: 0, x: data.index, y: value,_dataObj: selectedItem},data.index];\n this.invokeEventCallback('onSelect', [event.nativeEvent, this.proxy, selectedItem, selectedChartItem ]);\n }\n\n renderWidget(props: WmAreaChartProps) {\n this.invokeEventCallback('onBeforerender', [this.proxy, null]);\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 {...getAccessibilityProps(AccessibilityWidgetType.LINECHART, props)}\n style={this.styles.root}\n onLayout={this.onViewLayoutChange.bind(this)}\n >\n <View>\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 {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: props.offsettop, bottom: props.offsetbottom, left: props.offsetleft, right: props.offsetright }}\n minDomain={mindomain}\n containerComponent={\n this.getTooltip(props)\n }\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 name={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={this.isRTL?d.toReversed():d}\n />\n <VictoryScatter\n size={5}\n key={props.name + '_scatter' + i}\n style={{\n data: props.highlightpoints ? {fill: this.state.colors[i], opacity: 0.8}:{opacity: 0}\n }} \n data={this.isRTL?d.toReversed():d}\n events={[{\n target: 'data',\n eventHandlers: Platform.OS == \"web\" ? {\n onClick: this.onSelect.bind(this)\n }:{\n onPress: this.onSelect.bind(this)\n }\n }]}\n />\n </VictoryGroup>\n })\n }\n </Vict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CAACoB,UAAU,CAAC,CAAC,GAACpB,CAAE;QAClCwB,MAAM,EAAE,CAAC;UACPC,MAAM,EAAE,MAAM;UACdC,aAAa,EAAEzH,QAAQ,CAAC0H,EAAE,IAAI,KAAK,GAAG;YACpCC,OAAO,EAAE,IAAI,CAAC7F,QAAQ,CAACuC,IAAI,CAAC,IAAI;UAClC,CAAC,GAAC;YACAuD,OAAO,EAAE,IAAI,CAAC9F,QAAQ,CAACuC,IAAI,CAAC,IAAI;UAClC;QACF,CAAC;MAAE,CACF,CACO,CAAC;IACjB,CAAC,CAEW,CACF,CAAC,GAEjB,IACE,CAAC;EACT;AACF"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
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; }
|
|
3
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
4
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
5
2
|
import React from 'react';
|
|
6
3
|
import { View, Text, Platform } from 'react-native';
|
|
7
4
|
import { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility';
|
|
@@ -10,25 +7,10 @@ import { BaseChartComponent, BaseChartComponentState } from "@wavemaker/app-rn-r
|
|
|
10
7
|
import WmBarChartProps from './bar-chart.props';
|
|
11
8
|
import { DEFAULT_CLASS } from './bar-chart.styles';
|
|
12
9
|
import WmIcon from "@wavemaker/app-rn-runtime/components/basic/icon/icon.component";
|
|
13
|
-
export class WmBarChartState extends BaseChartComponentState {
|
|
14
|
-
constructor() {
|
|
15
|
-
super(...arguments);
|
|
16
|
-
_defineProperty(this, "chartWidth", 0);
|
|
17
|
-
_defineProperty(this, "totalHeight", 0);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
10
|
+
export class WmBarChartState extends BaseChartComponentState {}
|
|
20
11
|
export default class WmBarChart extends BaseChartComponent {
|
|
21
12
|
constructor(props) {
|
|
22
13
|
super(props, DEFAULT_CLASS, new WmBarChartProps(), new WmBarChartState());
|
|
23
|
-
_defineProperty(this, "onViewLayoutChange", e => {
|
|
24
|
-
var _e$nativeEvent;
|
|
25
|
-
console.log(e.nativeEvent.layout);
|
|
26
|
-
let viewWidth = e.nativeEvent.layout.width;
|
|
27
|
-
this.updateState({
|
|
28
|
-
chartWidth: Number(viewWidth),
|
|
29
|
-
totalHeight: Number((_e$nativeEvent = e.nativeEvent) === null || _e$nativeEvent === void 0 ? void 0 : _e$nativeEvent.layout.height)
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
14
|
}
|
|
33
15
|
labelFn(data) {
|
|
34
16
|
return this.abbreviateNumber(data.datum.y);
|
|
@@ -73,23 +55,12 @@ export default class WmBarChart extends BaseChartComponent {
|
|
|
73
55
|
let value = data.data[data.index].y;
|
|
74
56
|
let label = this.state.xaxisDatakeyArr[data.datum.x];
|
|
75
57
|
let selectedItem = this.props.dataset[data.index];
|
|
76
|
-
const nativeEvent = event.nativeEvent;
|
|
77
|
-
this.setTooltipPosition(nativeEvent);
|
|
78
58
|
let selectedChartItem = [{
|
|
79
59
|
series: 0,
|
|
80
60
|
x: data.index,
|
|
81
61
|
y: value,
|
|
82
62
|
_dataObj: selectedItem
|
|
83
63
|
}, data.index];
|
|
84
|
-
this.updateState({
|
|
85
|
-
tooltipXaxis: label,
|
|
86
|
-
tooltipYaxis: value,
|
|
87
|
-
isTooltipOpen: true,
|
|
88
|
-
selectedItem: {
|
|
89
|
-
...selectedItem,
|
|
90
|
-
index: data.index
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
64
|
this.invokeEventCallback('onSelect', [event.nativeEvent, this.proxy, selectedItem, selectedChartItem]);
|
|
94
65
|
}
|
|
95
66
|
renderWidget(props) {
|
|
@@ -102,9 +73,8 @@ export default class WmBarChart extends BaseChartComponent {
|
|
|
102
73
|
y: this.props.ydomain === 'Min' ? this.state.chartMinY : undefined
|
|
103
74
|
};
|
|
104
75
|
return /*#__PURE__*/React.createElement(View, _extends({}, getAccessibilityProps(AccessibilityWidgetType.LINECHART, props), {
|
|
105
|
-
style: this.styles.root
|
|
106
|
-
|
|
107
|
-
}), this.getTooltip(), /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, {
|
|
76
|
+
style: this.styles.root
|
|
77
|
+
}), /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, {
|
|
108
78
|
style: {
|
|
109
79
|
flexDirection: 'row',
|
|
110
80
|
alignItems: 'center'
|
|
@@ -118,15 +88,16 @@ export default class WmBarChart extends BaseChartComponent {
|
|
|
118
88
|
style: this.styles.subHeading
|
|
119
89
|
}, props.subheading)), /*#__PURE__*/React.createElement(VictoryChart, {
|
|
120
90
|
theme: this.state.theme,
|
|
121
|
-
height: this.
|
|
122
|
-
width: this.
|
|
91
|
+
height: this.styles.root.height,
|
|
92
|
+
width: this.styles.root.width || this.screenWidth,
|
|
123
93
|
minDomain: mindomain,
|
|
124
94
|
padding: {
|
|
125
95
|
top: props.offsettop,
|
|
126
96
|
bottom: props.offsetbottom,
|
|
127
97
|
left: props.offsetleft,
|
|
128
98
|
right: props.offsetright
|
|
129
|
-
}
|
|
99
|
+
},
|
|
100
|
+
containerComponent: this.getTooltip(props)
|
|
130
101
|
}, this.getLegendView(), this.getXaxis(), this.getYAxis(), props.viewtype === 'Stacked' ? /*#__PURE__*/React.createElement(VictoryStack, {
|
|
131
102
|
colorScale: this.state.colors
|
|
132
103
|
}, this.getBarChart(props)) : /*#__PURE__*/React.createElement(VictoryGroup, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","Text","Platform","AccessibilityWidgetType","getAccessibilityProps","VictoryChart","VictoryBar","VictoryStack","VictoryGroup","BaseChartComponent","BaseChartComponentState","WmBarChartProps","DEFAULT_CLASS","WmIcon","WmBarChartState","constructor","arguments","_defineProperty","WmBarChart","props","e","_e$nativeEvent","console","log","nativeEvent","layout","viewWidth","width","updateState","chartWidth","Number","totalHeight","height","labelFn","data","abbreviateNumber","datum","y","getBarChart","state","map","d","i","createElement","key","name","horizontal","labels","showvalues","bind","undefined","isRTL","toReversed","alignment","style","customcolors","fill","_ref","colors","x","length","cornerRadius","topLeft","styles","bar","borderTopLeftRadius","topRight","borderTopRightRadius","bottomLeft","borderBottomLeftRadius","bottomRight","borderBottomRightRadius","events","target","eventHandlers","OS","onClick","onSelect","onPress","event","value","index","label","xaxisDatakeyArr","selectedItem","dataset","setTooltipPosition","selectedChartItem","series","_dataObj","tooltipXaxis","tooltipYaxis","isTooltipOpen","invokeEventCallback","proxy","renderWidget","mindomain","xdomain","chartMinX","ydomain","chartMinY","_extends","LINECHART","root","onLayout","onViewLayoutChange","getTooltip","flexDirection","alignItems","iconclass","icon","title","subHeading","subheading","theme","screenWidth","minDomain","padding","top","offsettop","bottom","offsetbottom","left","offsetleft","right","offsetright","getLegendView","getXaxis","getYAxis","viewtype","colorScale","offset"],"sources":["bar-chart.component.tsx"],"sourcesContent":["import React from 'react';\nimport { View, Text, Platform, LayoutChangeEvent } from 'react-native';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility'; \nimport {\n VictoryChart,\n VictoryBar,\n VictoryLegend,\n VictoryStack,\n VictoryGroup\n} from \"victory-native\";\n\nimport {\n BaseChartComponent,\n BaseChartComponentState\n} from \"@wavemaker/app-rn-runtime/components/chart/basechart.component\";\nimport WmBarChartProps from './bar-chart.props';\nimport { DEFAULT_CLASS, WmBarChartStyles } from './bar-chart.styles';\nimport WmIcon from \"@wavemaker/app-rn-runtime/components/basic/icon/icon.component\";\nimport { min } from 'moment';\n\nexport class WmBarChartState extends BaseChartComponentState<WmBarChartProps> {\n chartWidth = 0;\n totalHeight = 0;\n}\n\nexport default class WmBarChart extends BaseChartComponent<WmBarChartProps, WmBarChartState, WmBarChartStyles> {\n\n constructor(props: WmBarChartProps) {\n super(props, DEFAULT_CLASS, new WmBarChartProps(), new WmBarChartState());\n }\n\n labelFn(data: any): string | number | string[] | number[] | null {\n return this.abbreviateNumber(data.datum.y);\n }\n\n getBarChart(props: WmBarChartProps) {\n return this.state.data.map((d: any, i: number) => {\n return <VictoryBar key={props.name + '_' + i}\n horizontal={props.horizontal} labels={props.showvalues ? this.labelFn.bind(this) : undefined}\n data={this.isRTL?d.toReversed():d}\n height={100}\n alignment='start'\n style={props.customcolors?{\n data: {\n fill: ({ datum }) => this.state.colors[datum.x] ?? this.state.colors[datum.x % this.state.colors.length]\n }\n }:{}}\n cornerRadius={{topLeft: this.styles.bar.borderTopLeftRadius, topRight: this.styles.bar.borderTopRightRadius, bottomLeft: this.styles.bar.borderBottomLeftRadius, bottomRight: this.styles.bar.borderBottomRightRadius}}\n events={[{\n target: 'data',\n eventHandlers: Platform.OS == \"web\" ? {\n onClick: this.onSelect.bind(this)\n }:{\n onPress: this.onSelect.bind(this)\n }\n }]}/>\n });\n}\n onViewLayoutChange = (e: LayoutChangeEvent) => {\n console.log(e.nativeEvent.layout)\n let viewWidth = e.nativeEvent.layout.width;\n this.updateState({\n chartWidth: Number(viewWidth),\n totalHeight: Number(e.nativeEvent?.layout.height)\n } as WmBarChartState)\n }\n\nonSelect(event: any, data: any){\n let value = data.data[data.index].y;\n let label = this.state.xaxisDatakeyArr[data.datum.x];\n let selectedItem = this.props.dataset[data.index];\n const nativeEvent = event.nativeEvent;\n this.setTooltipPosition(nativeEvent);\n let selectedChartItem = [{series: 0, x: data.index, y: value,_dataObj: selectedItem},data.index];\n this.updateState({\n tooltipXaxis: label,\n tooltipYaxis: value,\n isTooltipOpen: true,\n selectedItem: {...selectedItem, index: data.index},\n } as WmBarChartState)\n this.invokeEventCallback('onSelect', [event.nativeEvent, this.proxy, selectedItem, selectedChartItem ]);\n}\n\n renderWidget(props: WmBarChartProps) {\n this.invokeEventCallback('onBeforerender', [this.proxy, null]);\n if (!this.state.data.length) {\n return null;\n }\n let mindomain={x: this.props.xdomain === 'Min' ? this.state.chartMinX: undefined, y: this.props.ydomain === 'Min' ? this.state.chartMinY: undefined};\n return (<View\n {...getAccessibilityProps(AccessibilityWidgetType.LINECHART, props)}\n style={this.styles.root}\n onLayout={this.onViewLayoutChange}\n >\n {this.getTooltip()}\n <View>\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 <VictoryChart theme={this.state.theme}\n height={(this.state.totalHeight || this.styles.root.height) as number}\n width={this.state.chartWidth || this.screenWidth} \n minDomain={mindomain}\n padding={{ top: props.offsettop, bottom: props.offsetbottom, left: props.offsetleft, right: props.offsetright }}>\n {this.getLegendView()}\n {this.getXaxis()}\n {this.getYAxis()}\n {\n props.viewtype === 'Stacked' ? <VictoryStack colorScale={this.state.colors}>\n {\n this.getBarChart(props)\n }\n </VictoryStack> : <VictoryGroup colorScale={this.state.colors} offset={10} >\n {\n this.getBarChart(props) \n }\n </VictoryGroup>\n }\n </VictoryChart></View>);\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,QAA2B,cAAc;AACtE,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,8CAA8C;AAC7G,SACEC,YAAY,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AC8F,UAAiB,CACzD,CAAC,eACTlH,KAAA,CAAA4C,aAAA,CAACtC,YAAY;MAAC6G,KAAK,EAAE,IAAI,CAAC3E,KAAK,CAAC2E,KAAM;MAClBlF,MAAM,EAAG,IAAI,CAACO,KAAK,CAACR,WAAW,IAAI,IAAI,CAACgC,MAAM,CAACwC,IAAI,CAACvE,MAAkB;MACtEL,KAAK,EAAE,IAAI,CAACY,KAAK,CAACV,UAAU,IAAI,IAAI,CAACsF,WAAY;MACjDC,SAAS,EAAEpB,SAAU;MACrBqB,OAAO,EAAE;QAAEC,GAAG,EAAEnG,KAAK,CAACoG,SAAS;QAAEC,MAAM,EAAErG,KAAK,CAACsG,YAAY;QAAEC,IAAI,EAAEvG,KAAK,CAACwG,UAAU;QAAEC,KAAK,EAAEzG,KAAK,CAAC0G;MAAY;IAAE,GACnI,IAAI,CAACC,aAAa,CAAC,CAAC,EACpB,IAAI,CAACC,QAAQ,CAAC,CAAC,EACf,IAAI,CAACC,QAAQ,CAAC,CAAC,EAEd7G,KAAK,CAAC8G,QAAQ,KAAK,SAAS,gBAAGlI,KAAA,CAAA4C,aAAA,CAACpC,YAAY;MAAC2H,UAAU,EAAE,IAAI,CAAC3F,KAAK,CAACmB;IAAO,GAEvE,IAAI,CAACpB,WAAW,CAACnB,KAAK,CAEZ,CAAC,gBAAGpB,KAAA,CAAA4C,aAAA,CAACnC,YAAY;MAAC0H,UAAU,EAAE,IAAI,CAAC3F,KAAK,CAACmB,MAAO;MAAEyE,MAAM,EAAE;IAAG,GAEvE,IAAI,CAAC7F,WAAW,CAACnB,KAAK,CAEZ,CAEJ,CAAO,CAAC;EACxB;AACF"}
|
|
1
|
+
{"version":3,"names":["React","View","Text","Platform","AccessibilityWidgetType","getAccessibilityProps","VictoryChart","VictoryBar","VictoryStack","VictoryGroup","BaseChartComponent","BaseChartComponentState","WmBarChartProps","DEFAULT_CLASS","WmIcon","WmBarChartState","WmBarChart","constructor","props","labelFn","data","abbreviateNumber","datum","y","getBarChart","state","map","d","i","createElement","key","name","horizontal","labels","showvalues","bind","undefined","isRTL","toReversed","height","alignment","style","customcolors","fill","_ref","colors","x","length","cornerRadius","topLeft","styles","bar","borderTopLeftRadius","topRight","borderTopRightRadius","bottomLeft","borderBottomLeftRadius","bottomRight","borderBottomRightRadius","events","target","eventHandlers","OS","onClick","onSelect","onPress","event","value","index","label","xaxisDatakeyArr","selectedItem","dataset","selectedChartItem","series","_dataObj","invokeEventCallback","nativeEvent","proxy","renderWidget","mindomain","xdomain","chartMinX","ydomain","chartMinY","_extends","LINECHART","root","flexDirection","alignItems","iconclass","icon","title","subHeading","subheading","theme","width","screenWidth","minDomain","padding","top","offsettop","bottom","offsetbottom","left","offsetleft","right","offsetright","containerComponent","getTooltip","getLegendView","getXaxis","getYAxis","viewtype","colorScale","offset"],"sources":["bar-chart.component.tsx"],"sourcesContent":["import React from 'react';\nimport { View, Text, Platform } from 'react-native';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility'; \nimport {\n VictoryChart,\n VictoryBar,\n VictoryLegend,\n VictoryStack,\n VictoryGroup\n} from \"victory-native\";\n\nimport {\n BaseChartComponent,\n BaseChartComponentState\n} from \"@wavemaker/app-rn-runtime/components/chart/basechart.component\";\nimport WmBarChartProps from './bar-chart.props';\nimport { DEFAULT_CLASS, WmBarChartStyles } from './bar-chart.styles';\nimport WmIcon from \"@wavemaker/app-rn-runtime/components/basic/icon/icon.component\";\nimport { min } from 'moment';\n\nexport class WmBarChartState extends BaseChartComponentState<WmBarChartProps> {}\n\nexport default class WmBarChart extends BaseChartComponent<WmBarChartProps, WmBarChartState, WmBarChartStyles> {\n\n constructor(props: WmBarChartProps) {\n super(props, DEFAULT_CLASS, new WmBarChartProps(), new WmBarChartState());\n }\n\n labelFn(data: any): string | number | string[] | number[] | null {\n return this.abbreviateNumber(data.datum.y);\n }\n\n getBarChart(props: WmBarChartProps) {\n return this.state.data.map((d: any, i: number) => {\n return <VictoryBar key={props.name + '_' + i}\n horizontal={props.horizontal} labels={props.showvalues ? this.labelFn.bind(this) : undefined}\n data={this.isRTL?d.toReversed():d}\n height={100}\n alignment='start'\n style={props.customcolors?{\n data: {\n fill: ({ datum }) => this.state.colors[datum.x] ?? this.state.colors[datum.x % this.state.colors.length]\n }\n }:{}}\n cornerRadius={{topLeft: this.styles.bar.borderTopLeftRadius, topRight: this.styles.bar.borderTopRightRadius, bottomLeft: this.styles.bar.borderBottomLeftRadius, bottomRight: this.styles.bar.borderBottomRightRadius}}\n events={[{\n target: 'data',\n eventHandlers: Platform.OS == \"web\" ? {\n onClick: this.onSelect.bind(this)\n }:{\n onPress: this.onSelect.bind(this)\n }\n }]}/>\n });\n}\n\nonSelect(event: any, data: any){\n let value = data.data[data.index].y;\n let label = this.state.xaxisDatakeyArr[data.datum.x];\n let selectedItem = this.props.dataset[data.index];\n let selectedChartItem = [{series: 0, x: data.index, y: value,_dataObj: selectedItem},data.index];\n this.invokeEventCallback('onSelect', [event.nativeEvent, this.proxy, selectedItem, selectedChartItem ]);\n}\n\n renderWidget(props: WmBarChartProps) {\n this.invokeEventCallback('onBeforerender', [this.proxy, null]);\n if (!this.state.data.length) {\n return null;\n }\n let mindomain={x: this.props.xdomain === 'Min' ? this.state.chartMinX: undefined, y: this.props.ydomain === 'Min' ? this.state.chartMinY: undefined};\n return (<View\n {...getAccessibilityProps(AccessibilityWidgetType.LINECHART, props)}\n style={this.styles.root}\n >\n <View>\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 <VictoryChart theme={this.state.theme}\n height={this.styles.root.height as number}\n width={this.styles.root.width as number || this.screenWidth} \n minDomain={mindomain}\n padding={{ top: props.offsettop, bottom: props.offsetbottom, left: props.offsetleft, right: props.offsetright }}\n containerComponent={\n this.getTooltip(props)\n }>\n {this.getLegendView()}\n {this.getXaxis()}\n {this.getYAxis()}\n {\n props.viewtype === 'Stacked' ? <VictoryStack colorScale={this.state.colors}>\n {\n this.getBarChart(props)\n }\n </VictoryStack> : <VictoryGroup colorScale={this.state.colors} offset={10} >\n {\n this.getBarChart(props) \n }\n </VictoryGroup>\n }\n </VictoryChart></View>);\n }\n}\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,cAAc;AACnD,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,8CAA8C;AAC7G,SACEC,YAAY,EACZC,UAAU,EAEVC,YAAY,EACZC,YAAY,QACP,gBAAgB;AAEvB,SACEC,kBAAkB,EAClBC,uBAAuB,QAClB,gEAAgE;AACvE,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,SAASC,aAAa,QAA0B,oBAAoB;AACpE,OAAOC,MAAM,MAAM,gEAAgE;AAGnF,OAAO,MAAMC,eAAe,SAASJ,uBAAuB,CAAkB;AAE9E,eAAe,MAAMK,UAAU,SAASN,kBAAkB,CAAqD;EAE7GO,WAAWA,CAACC,KAAsB,EAAE;IAClC,KAAK,CAACA,KAAK,EAAEL,aAAa,EAAE,IAAID,eAAe,CAAC,CAAC,EAAE,IAAIG,eAAe,CAAC,CAAC,CAAC;EAC3E;EAEAI,OAAOA,CAACC,IAAS,EAAgD;IAC/D,OAAO,IAAI,CAACC,gBAAgB,CAACD,IAAI,CAACE,KAAK,CAACC,CAAC,CAAC;EAC5C;EAEAC,WAAWA,CAACN,KAAsB,EAAE;IACpC,OAAO,IAAI,CAACO,KAAK,CAACL,IAAI,CAACM,GAAG,CAAC,CAACC,CAAM,EAAEC,CAAS,KAAK;MAChD,oBAAO5B,KAAA,CAAA6B,aAAA,CAACtB,UAAU;QAACuB,GAAG,EAAEZ,KAAK,CAACa,IAAI,GAAG,GAAG,GAAGH,CAAE;QACzCI,UAAU,EAAE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