@wavemaker/app-rn-runtime 11.5.0-next.40301 → 11.5.0-rc.151
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/login-action.js +4 -0
- app-rn-runtime/actions/login-action.js.map +1 -1
- app-rn-runtime/actions/logout-action.js +4 -0
- app-rn-runtime/actions/logout-action.js.map +1 -1
- app-rn-runtime/components/advanced/carousel/carousel-template/carousel-template.component.js +4 -1
- app-rn-runtime/components/advanced/carousel/carousel-template/carousel-template.component.js.map +1 -1
- app-rn-runtime/components/advanced/carousel/carousel-template/carousel-template.styles.js +1 -2
- app-rn-runtime/components/advanced/carousel/carousel-template/carousel-template.styles.js.map +1 -1
- app-rn-runtime/components/advanced/carousel/carousel.component.js +130 -68
- app-rn-runtime/components/advanced/carousel/carousel.component.js.map +1 -1
- app-rn-runtime/components/advanced/carousel/carousel.props.js +3 -0
- app-rn-runtime/components/advanced/carousel/carousel.props.js.map +1 -1
- app-rn-runtime/components/advanced/carousel/carousel.styles.js +17 -9
- app-rn-runtime/components/advanced/carousel/carousel.styles.js.map +1 -1
- app-rn-runtime/components/advanced/login/login.component.js +3 -2
- app-rn-runtime/components/advanced/login/login.component.js.map +1 -1
- app-rn-runtime/components/advanced/network-info-toaster/network-info-toaster.component.js +17 -16
- app-rn-runtime/components/advanced/network-info-toaster/network-info-toaster.component.js.map +1 -1
- app-rn-runtime/components/advanced/webview/webview.component.js +1 -0
- app-rn-runtime/components/advanced/webview/webview.component.js.map +1 -1
- app-rn-runtime/components/basic/anchor/anchor.component.js +7 -5
- app-rn-runtime/components/basic/anchor/anchor.component.js.map +1 -1
- app-rn-runtime/components/basic/animatedview.component.js +50 -0
- app-rn-runtime/components/basic/animatedview.component.js.map +1 -1
- app-rn-runtime/components/basic/audio/audio.component.js +5 -0
- app-rn-runtime/components/basic/audio/audio.component.js.map +1 -1
- app-rn-runtime/components/basic/button/button.component.js +7 -6
- app-rn-runtime/components/basic/button/button.component.js.map +1 -1
- app-rn-runtime/components/basic/button/button.styles.js +14 -4
- app-rn-runtime/components/basic/button/button.styles.js.map +1 -1
- app-rn-runtime/components/basic/buttongroup/buttongroup.styles.js +2 -1
- app-rn-runtime/components/basic/buttongroup/buttongroup.styles.js.map +1 -1
- app-rn-runtime/components/basic/icon/icon.component.js +11 -5
- app-rn-runtime/components/basic/icon/icon.component.js.map +1 -1
- app-rn-runtime/components/basic/icon/icon.props.js +1 -0
- app-rn-runtime/components/basic/icon/icon.props.js.map +1 -1
- app-rn-runtime/components/basic/label/label.component.js +60 -3
- app-rn-runtime/components/basic/label/label.component.js.map +1 -1
- app-rn-runtime/components/basic/label/label.styles.js +2 -1
- app-rn-runtime/components/basic/label/label.styles.js.map +1 -1
- app-rn-runtime/components/basic/message/message.component.js +6 -3
- app-rn-runtime/components/basic/message/message.component.js.map +1 -1
- app-rn-runtime/components/basic/picture/picture.component.js +7 -5
- app-rn-runtime/components/basic/picture/picture.component.js.map +1 -1
- app-rn-runtime/components/basic/progress-bar/progress-bar.component.js +4 -2
- app-rn-runtime/components/basic/progress-bar/progress-bar.component.js.map +1 -1
- app-rn-runtime/components/basic/progress-bar/progress-bar.styles.js +1 -1
- app-rn-runtime/components/basic/progress-bar/progress-bar.styles.js.map +1 -1
- app-rn-runtime/components/basic/progress-circle/progress-circle.component.js +3 -2
- app-rn-runtime/components/basic/progress-circle/progress-circle.component.js.map +1 -1
- app-rn-runtime/components/basic/search/search.component.js +12 -6
- app-rn-runtime/components/basic/search/search.component.js.map +1 -1
- app-rn-runtime/components/basic/search/search.styles.js +11 -10
- app-rn-runtime/components/basic/search/search.styles.js.map +1 -1
- app-rn-runtime/components/basic/spinner/spinner.component.js +6 -2
- app-rn-runtime/components/basic/spinner/spinner.component.js.map +1 -1
- app-rn-runtime/components/basic/spinner/spinner.styles.js +3 -2
- app-rn-runtime/components/basic/spinner/spinner.styles.js.map +1 -1
- app-rn-runtime/components/basic/video/video.component.js +2 -1
- app-rn-runtime/components/basic/video/video.component.js.map +1 -1
- app-rn-runtime/components/chart/basechart.component.js +19 -8
- app-rn-runtime/components/chart/basechart.component.js.map +1 -1
- app-rn-runtime/components/chart/pie-chart/pie-chart.component.js +23 -2
- app-rn-runtime/components/chart/pie-chart/pie-chart.component.js.map +1 -1
- app-rn-runtime/components/chart/pie-chart/pie-chart.props.js +1 -0
- app-rn-runtime/components/chart/pie-chart/pie-chart.props.js.map +1 -1
- app-rn-runtime/components/chart/stack-chart/stack-chart.component.js +213 -0
- app-rn-runtime/components/chart/stack-chart/stack-chart.component.js.map +1 -0
- app-rn-runtime/components/chart/stack-chart/stack-chart.props.js +15 -0
- app-rn-runtime/components/chart/stack-chart/stack-chart.props.js.map +1 -0
- app-rn-runtime/components/chart/stack-chart/stack-chart.styles.js +7 -0
- app-rn-runtime/components/chart/stack-chart/stack-chart.styles.js.map +1 -0
- app-rn-runtime/components/container/accordion/accordion.component.js +22 -15
- app-rn-runtime/components/container/accordion/accordion.component.js.map +1 -1
- app-rn-runtime/components/container/accordion/accordionpane/accordionpane.component.js +6 -24
- app-rn-runtime/components/container/accordion/accordionpane/accordionpane.component.js.map +1 -1
- app-rn-runtime/components/container/container.component.js +3 -2
- app-rn-runtime/components/container/container.component.js.map +1 -1
- app-rn-runtime/components/container/panel/collapsible-pane.component.js +26 -0
- app-rn-runtime/components/container/panel/collapsible-pane.component.js.map +1 -0
- app-rn-runtime/components/container/panel/panel.component.js +44 -62
- app-rn-runtime/components/container/panel/panel.component.js.map +1 -1
- app-rn-runtime/components/container/panel/panel.styles.js +9 -2
- app-rn-runtime/components/container/panel/panel.styles.js.map +1 -1
- app-rn-runtime/components/container/partial-host.component.js +1 -1
- app-rn-runtime/components/container/partial-host.component.js.map +1 -1
- app-rn-runtime/components/container/tabs/tabheader/tabheader.component.js +7 -5
- app-rn-runtime/components/container/tabs/tabheader/tabheader.component.js.map +1 -1
- app-rn-runtime/components/container/tabs/tabheader/tabheader.styles.js +9 -5
- app-rn-runtime/components/container/tabs/tabheader/tabheader.styles.js.map +1 -1
- app-rn-runtime/components/container/tabs/tabpane/tabpane.component.js +1 -1
- app-rn-runtime/components/container/tabs/tabpane/tabpane.component.js.map +1 -1
- app-rn-runtime/components/container/tabs/tabs.component.js +1 -0
- app-rn-runtime/components/container/tabs/tabs.component.js.map +1 -1
- app-rn-runtime/components/container/tile/tile.component.js +3 -2
- app-rn-runtime/components/container/tile/tile.component.js.map +1 -1
- app-rn-runtime/components/container/wizard/wizard.component.js +9 -4
- app-rn-runtime/components/container/wizard/wizard.component.js.map +1 -1
- app-rn-runtime/components/container/wizard/wizard.styles.js +18 -5
- app-rn-runtime/components/container/wizard/wizard.styles.js.map +1 -1
- app-rn-runtime/components/data/card/card-content/card-content.component.js +1 -1
- app-rn-runtime/components/data/card/card-content/card-content.component.js.map +1 -1
- app-rn-runtime/components/data/card/card.component.js +3 -2
- app-rn-runtime/components/data/card/card.component.js.map +1 -1
- app-rn-runtime/components/data/form/form-action/form-action.component.js +1 -0
- app-rn-runtime/components/data/form/form-action/form-action.component.js.map +1 -1
- app-rn-runtime/components/data/form/form-field/form-field.component.js +3 -2
- app-rn-runtime/components/data/form/form-field/form-field.component.js.map +1 -1
- app-rn-runtime/components/data/form/form.component.js +3 -0
- app-rn-runtime/components/data/form/form.component.js.map +1 -1
- app-rn-runtime/components/data/list/list-template/list-template.component.js +15 -1
- app-rn-runtime/components/data/list/list-template/list-template.component.js.map +1 -1
- app-rn-runtime/components/data/list/list-template/list-template.styles.js +9 -1
- app-rn-runtime/components/data/list/list-template/list-template.styles.js.map +1 -1
- app-rn-runtime/components/data/list/list.component.js +41 -31
- app-rn-runtime/components/data/list/list.component.js.map +1 -1
- app-rn-runtime/components/data/list/list.props.js +6 -0
- app-rn-runtime/components/data/list/list.props.js.map +1 -1
- app-rn-runtime/components/data/list/list.styles.js +12 -5
- app-rn-runtime/components/data/list/list.styles.js.map +1 -1
- app-rn-runtime/components/device/barcodescanner/barcodescanner.component.js +1 -0
- app-rn-runtime/components/device/barcodescanner/barcodescanner.component.js.map +1 -1
- app-rn-runtime/components/device/barcodescanner/barcodescanner.styles.js +2 -1
- app-rn-runtime/components/device/barcodescanner/barcodescanner.styles.js.map +1 -1
- app-rn-runtime/components/device/camera/camera.component.js +1 -0
- app-rn-runtime/components/device/camera/camera.component.js.map +1 -1
- app-rn-runtime/components/device/camera/camera.styles.js +2 -1
- app-rn-runtime/components/device/camera/camera.styles.js.map +1 -1
- app-rn-runtime/components/dialogs/alertdialog/alertdialog.component.js +4 -1
- app-rn-runtime/components/dialogs/alertdialog/alertdialog.component.js.map +1 -1
- app-rn-runtime/components/dialogs/alertdialog/alertdialog.styles.js +9 -3
- app-rn-runtime/components/dialogs/alertdialog/alertdialog.styles.js.map +1 -1
- app-rn-runtime/components/dialogs/confirmdialog/confirmdialog.component.js +6 -2
- app-rn-runtime/components/dialogs/confirmdialog/confirmdialog.component.js.map +1 -1
- app-rn-runtime/components/dialogs/confirmdialog/confirmdialog.styles.js +10 -10
- app-rn-runtime/components/dialogs/confirmdialog/confirmdialog.styles.js.map +1 -1
- app-rn-runtime/components/dialogs/dialog/dialog.component.js +2 -0
- app-rn-runtime/components/dialogs/dialog/dialog.component.js.map +1 -1
- app-rn-runtime/components/dialogs/dialog/dialog.styles.js +17 -8
- app-rn-runtime/components/dialogs/dialog/dialog.styles.js.map +1 -1
- app-rn-runtime/components/dialogs/dialogcontent/dialogcontent.component.js +4 -2
- app-rn-runtime/components/dialogs/dialogcontent/dialogcontent.component.js.map +1 -1
- app-rn-runtime/components/dialogs/dialogcontent/dialogcontent.styles.js +2 -1
- app-rn-runtime/components/dialogs/dialogcontent/dialogcontent.styles.js.map +1 -1
- app-rn-runtime/components/input/calendar/calendar.component.js +4 -0
- app-rn-runtime/components/input/calendar/calendar.component.js.map +1 -1
- app-rn-runtime/components/input/calendar/calendar.styles.js +22 -11
- app-rn-runtime/components/input/calendar/calendar.styles.js.map +1 -1
- app-rn-runtime/components/input/calendar/views/month-view.js +4 -0
- app-rn-runtime/components/input/calendar/views/month-view.js.map +1 -1
- app-rn-runtime/components/input/checkbox/checkbox.component.js +6 -6
- app-rn-runtime/components/input/checkbox/checkbox.component.js.map +1 -1
- app-rn-runtime/components/input/checkboxset/checkboxset.component.js +6 -6
- app-rn-runtime/components/input/checkboxset/checkboxset.component.js.map +1 -1
- app-rn-runtime/components/input/chips/chips.component.js +8 -4
- app-rn-runtime/components/input/chips/chips.component.js.map +1 -1
- app-rn-runtime/components/input/chips/chips.styles.js +20 -12
- app-rn-runtime/components/input/chips/chips.styles.js.map +1 -1
- app-rn-runtime/components/input/composite/composite.component.js +8 -1
- app-rn-runtime/components/input/composite/composite.component.js.map +1 -1
- app-rn-runtime/components/input/composite/composite.props.js +1 -0
- app-rn-runtime/components/input/composite/composite.props.js.map +1 -1
- app-rn-runtime/components/input/composite/composite.styles.js +16 -1
- app-rn-runtime/components/input/composite/composite.styles.js.map +1 -1
- app-rn-runtime/components/input/currency/currency.component.js +1 -1
- app-rn-runtime/components/input/currency/currency.component.js.map +1 -1
- app-rn-runtime/components/input/currency/currency.styles.js +12 -4
- app-rn-runtime/components/input/currency/currency.styles.js.map +1 -1
- app-rn-runtime/components/input/epoch/base-datetime.component.js +6 -4
- app-rn-runtime/components/input/epoch/base-datetime.component.js.map +1 -1
- app-rn-runtime/components/input/fileupload/fileupload.component.js +1 -0
- app-rn-runtime/components/input/fileupload/fileupload.component.js.map +1 -1
- app-rn-runtime/components/input/number/number.component.js +1 -1
- app-rn-runtime/components/input/number/number.component.js.map +1 -1
- app-rn-runtime/components/input/number/number.styles.js +6 -2
- app-rn-runtime/components/input/number/number.styles.js.map +1 -1
- app-rn-runtime/components/input/radioset/radioset.component.js +10 -5
- app-rn-runtime/components/input/radioset/radioset.component.js.map +1 -1
- app-rn-runtime/components/input/radioset/radioset.props.js +6 -0
- app-rn-runtime/components/input/radioset/radioset.props.js.map +1 -1
- app-rn-runtime/components/input/radioset/radioset.styles.js +4 -8
- app-rn-runtime/components/input/radioset/radioset.styles.js.map +1 -1
- app-rn-runtime/components/input/rating/rating.component.js +2 -0
- app-rn-runtime/components/input/rating/rating.component.js.map +1 -1
- app-rn-runtime/components/input/select/select.component.js +17 -13
- app-rn-runtime/components/input/select/select.component.js.map +1 -1
- app-rn-runtime/components/input/select/select.styles.js +8 -4
- app-rn-runtime/components/input/select/select.styles.js.map +1 -1
- app-rn-runtime/components/input/slider/slider.component.js +94 -23
- app-rn-runtime/components/input/slider/slider.component.js.map +1 -1
- app-rn-runtime/components/input/slider/slider.styles.js +27 -2
- app-rn-runtime/components/input/slider/slider.styles.js.map +1 -1
- app-rn-runtime/components/input/switch/switch.component.js +6 -4
- app-rn-runtime/components/input/switch/switch.component.js.map +1 -1
- app-rn-runtime/components/input/switch/switch.styles.js +7 -4
- app-rn-runtime/components/input/switch/switch.styles.js.map +1 -1
- app-rn-runtime/components/input/text/text.component.js +1 -1
- app-rn-runtime/components/input/text/text.component.js.map +1 -1
- app-rn-runtime/components/input/text/text.styles.js +5 -1
- app-rn-runtime/components/input/text/text.styles.js.map +1 -1
- app-rn-runtime/components/input/textarea/textarea.component.js +1 -1
- app-rn-runtime/components/input/textarea/textarea.component.js.map +1 -1
- app-rn-runtime/components/input/toggle/toggle.component.js +3 -2
- app-rn-runtime/components/input/toggle/toggle.component.js.map +1 -1
- app-rn-runtime/components/input/toggle/toggle.styles.js +21 -9
- app-rn-runtime/components/input/toggle/toggle.styles.js.map +1 -1
- app-rn-runtime/components/navigation/appnavbar/appnavbar.component.js +7 -2
- app-rn-runtime/components/navigation/appnavbar/appnavbar.component.js.map +1 -1
- app-rn-runtime/components/navigation/appnavbar/appnavbar.styles.js +1 -1
- app-rn-runtime/components/navigation/appnavbar/appnavbar.styles.js.map +1 -1
- app-rn-runtime/components/navigation/basenav/basenav.component.js +2 -0
- app-rn-runtime/components/navigation/basenav/basenav.component.js.map +1 -1
- app-rn-runtime/components/navigation/menu/menu.component.js +5 -3
- app-rn-runtime/components/navigation/menu/menu.component.js.map +1 -1
- app-rn-runtime/components/navigation/menu/menu.styles.js +10 -6
- app-rn-runtime/components/navigation/menu/menu.styles.js.map +1 -1
- app-rn-runtime/components/navigation/navbar/navbar.component.js +7 -4
- app-rn-runtime/components/navigation/navbar/navbar.component.js.map +1 -1
- app-rn-runtime/components/navigation/navitem/navitem.component.js +6 -3
- app-rn-runtime/components/navigation/navitem/navitem.component.js.map +1 -1
- app-rn-runtime/components/navigation/navitem/navitem.styles.js +14 -10
- app-rn-runtime/components/navigation/navitem/navitem.styles.js.map +1 -1
- app-rn-runtime/components/navigation/popover/popover.component.js +10 -5
- app-rn-runtime/components/navigation/popover/popover.component.js.map +1 -1
- app-rn-runtime/components/navigation/popover/popover.props.js.map +1 -1
- app-rn-runtime/components/navigation/popover/popover.styles.js +8 -2
- app-rn-runtime/components/navigation/popover/popover.styles.js.map +1 -1
- app-rn-runtime/components/page/left-panel/left-panel.component.js +2 -2
- app-rn-runtime/components/page/left-panel/left-panel.component.js.map +1 -1
- app-rn-runtime/components/page/left-panel/left-panel.styles.js +6 -1
- app-rn-runtime/components/page/left-panel/left-panel.styles.js.map +1 -1
- app-rn-runtime/components/page/tabbar/tabbar.component.js +7 -6
- app-rn-runtime/components/page/tabbar/tabbar.component.js.map +1 -1
- app-rn-runtime/components/page/tabbar/tabbar.styles.js +22 -0
- app-rn-runtime/components/page/tabbar/tabbar.styles.js.map +1 -1
- app-rn-runtime/core/base.component.js +80 -37
- app-rn-runtime/core/base.component.js.map +1 -1
- app-rn-runtime/core/constant.service.js +22 -0
- app-rn-runtime/core/constant.service.js.map +1 -0
- app-rn-runtime/core/formatters.js +9 -2
- app-rn-runtime/core/formatters.js.map +1 -1
- app-rn-runtime/core/imageSizeEstimator.js +4 -0
- app-rn-runtime/core/imageSizeEstimator.js.map +1 -1
- app-rn-runtime/core/key.extractor.js +22 -0
- app-rn-runtime/core/key.extractor.js.map +1 -0
- app-rn-runtime/core/tappable.component.js +15 -5
- app-rn-runtime/core/tappable.component.js.map +1 -1
- app-rn-runtime/core/testid.provider.js +5 -0
- app-rn-runtime/core/testid.provider.js.map +1 -0
- app-rn-runtime/gestures/swipe.animation.js +34 -11
- app-rn-runtime/gestures/swipe.animation.js.map +1 -1
- app-rn-runtime/package.json +4 -3
- app-rn-runtime/runtime/App.js +29 -4
- app-rn-runtime/runtime/App.js.map +1 -1
- app-rn-runtime/runtime/base-fragment.component.js +13 -3
- app-rn-runtime/runtime/base-fragment.component.js.map +1 -1
- app-rn-runtime/runtime/base-page.component.js +17 -0
- app-rn-runtime/runtime/base-page.component.js.map +1 -1
- app-rn-runtime/runtime/services/app-security.service.js +14 -3
- app-rn-runtime/runtime/services/app-security.service.js.map +1 -1
- app-rn-runtime/runtime/services/device/camera-service.js +26 -9
- app-rn-runtime/runtime/services/device/camera-service.js.map +1 -1
- app-rn-runtime/runtime/services/device/scan-service.js +16 -2
- app-rn-runtime/runtime/services/device/scan-service.js.map +1 -1
- app-rn-runtime/styles/theme.js +30 -1
- app-rn-runtime/styles/theme.js.map +1 -1
- app-rn-runtime/styles/theme.variables.js +14 -3
- app-rn-runtime/styles/theme.variables.js.map +1 -1
- app-rn-runtime/variables/http.service.js +1 -1
- app-rn-runtime/variables/http.service.js.map +1 -1
- app-rn-runtime/variables/live-variable.js +1 -0
- app-rn-runtime/variables/live-variable.js.map +1 -1
- app-rn-runtime/variables/model-variable.js +11 -0
- app-rn-runtime/variables/model-variable.js.map +1 -1
- app-rn-runtime/variables/service-variable.js +1 -0
- app-rn-runtime/variables/service-variable.js.map +1 -1
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { View } from 'react-native';
|
|
6
|
+
import { Svg } from 'react-native-svg';
|
|
7
|
+
import { VictoryStack, VictoryBar, VictoryChart, VictoryPie, VictoryLegend, VictoryAxis } from 'victory-native';
|
|
8
|
+
import { Axis, Scale } from 'victory-core';
|
|
9
|
+
import { orderBy, cloneDeep } from 'lodash';
|
|
10
|
+
import WmStackChartProps from './stack-chart.props';
|
|
11
|
+
import { DEFAULT_CLASS } from './stack-chart.styles';
|
|
12
|
+
import { BaseChartComponent, BaseChartComponentState } from '@wavemaker/app-rn-runtime/components/chart/basechart.component';
|
|
13
|
+
export class WmStackChartState extends BaseChartComponentState {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
_defineProperty(this, "chartWidth", 0);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export default class WmStackChart extends BaseChartComponent {
|
|
20
|
+
constructor(props) {
|
|
21
|
+
super(props, DEFAULT_CLASS, new WmStackChartProps(), new WmStackChartState());
|
|
22
|
+
_defineProperty(this, "onViewLayoutChange", e => {
|
|
23
|
+
let viewWidth = e.nativeEvent.layout.width;
|
|
24
|
+
this.updateState({
|
|
25
|
+
chartWidth: viewWidth
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
componentDidMount() {
|
|
30
|
+
super.componentDidMount();
|
|
31
|
+
this.setHeightWidthOnChart();
|
|
32
|
+
}
|
|
33
|
+
getBarChart(props) {
|
|
34
|
+
if (this.state.data.length > 0) {
|
|
35
|
+
let data = cloneDeep(this.state.data[0]);
|
|
36
|
+
data = orderBy(data, 'y', 'asc');
|
|
37
|
+
let currentValue = 0;
|
|
38
|
+
return data.map((d, i) => {
|
|
39
|
+
let d1 = [];
|
|
40
|
+
d.x = 0;
|
|
41
|
+
d.y = d.y - currentValue;
|
|
42
|
+
d1.push(d);
|
|
43
|
+
currentValue = d.y + currentValue;
|
|
44
|
+
return /*#__PURE__*/React.createElement(VictoryBar, {
|
|
45
|
+
key: props.name + '_' + i,
|
|
46
|
+
cornerRadius: {
|
|
47
|
+
bottomLeft: 3,
|
|
48
|
+
bottomRight: 3,
|
|
49
|
+
topLeft: 3,
|
|
50
|
+
topRight: 3
|
|
51
|
+
},
|
|
52
|
+
data: d1
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
getColorCodes() {
|
|
58
|
+
const colors = cloneDeep(this.state.colors);
|
|
59
|
+
return colors.reverse();
|
|
60
|
+
}
|
|
61
|
+
getArcChart(props) {
|
|
62
|
+
if (this.state.data.length > 0) {
|
|
63
|
+
let data = cloneDeep(this.state.data[0]);
|
|
64
|
+
const colorScaleArray = this.getColorCodes();
|
|
65
|
+
const maxValue = Math.max(...data.map(o => o.y));
|
|
66
|
+
data = orderBy(data, 'y', 'desc');
|
|
67
|
+
const radius = 170;
|
|
68
|
+
return data.map((d, i) => {
|
|
69
|
+
let d1 = [];
|
|
70
|
+
d1.push(d);
|
|
71
|
+
d1.push({
|
|
72
|
+
x: d.x,
|
|
73
|
+
y: maxValue - d.y
|
|
74
|
+
});
|
|
75
|
+
return /*#__PURE__*/React.createElement(VictoryPie, {
|
|
76
|
+
key: props.name + '_' + i,
|
|
77
|
+
radius: radius,
|
|
78
|
+
colorScale: [colorScaleArray[i], '#fff0'],
|
|
79
|
+
startAngle: -80,
|
|
80
|
+
endAngle: 80,
|
|
81
|
+
cornerRadius: 100,
|
|
82
|
+
standalone: false,
|
|
83
|
+
origin: {
|
|
84
|
+
x: this.state.chartWidth / 2,
|
|
85
|
+
y: this.state.chartHeight - 50
|
|
86
|
+
},
|
|
87
|
+
innerRadius: radius - this.state.props.thickness,
|
|
88
|
+
labels: [],
|
|
89
|
+
data: d1
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
getArcAxis() {
|
|
95
|
+
const ticks = this.getTickValues();
|
|
96
|
+
const radius = 170;
|
|
97
|
+
const axisData = [];
|
|
98
|
+
ticks.forEach((d, i) => {
|
|
99
|
+
axisData.push({
|
|
100
|
+
x: `${this.state.props.yunits}${d}`,
|
|
101
|
+
y: 1
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
return /*#__PURE__*/React.createElement(VictoryPie, {
|
|
105
|
+
style: {
|
|
106
|
+
labels: {
|
|
107
|
+
fontSize: 12,
|
|
108
|
+
paddingLeft: 50,
|
|
109
|
+
paddingRight: 80
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
startAngle: -90,
|
|
113
|
+
endAngle: 90,
|
|
114
|
+
standalone: false,
|
|
115
|
+
colorScale: ['#fff0'],
|
|
116
|
+
origin: {
|
|
117
|
+
x: this.state.chartWidth / 2 - 5,
|
|
118
|
+
y: this.state.chartHeight - 50
|
|
119
|
+
},
|
|
120
|
+
labelRadius: radius - this.state.props.thickness - 20,
|
|
121
|
+
data: axisData
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
getTickValues() {
|
|
125
|
+
let ticks = [];
|
|
126
|
+
if (this.state.data[0].length) {
|
|
127
|
+
let data = cloneDeep(this.state.data[0]);
|
|
128
|
+
const maxValue = Math.max(...data.map(o => o.y));
|
|
129
|
+
const scale = Scale.getBaseScale({}, 'x');
|
|
130
|
+
scale.domain([0, maxValue]);
|
|
131
|
+
ticks = Axis.getTicks({}, scale);
|
|
132
|
+
}
|
|
133
|
+
return ticks;
|
|
134
|
+
}
|
|
135
|
+
renderWidget(props) {
|
|
136
|
+
if (!this.state.data.length) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
let mindomain = {
|
|
140
|
+
x: this.props.xdomain === 'Min' ? this.state.chartMinX : undefined,
|
|
141
|
+
y: this.props.ydomain === 'Min' ? this.state.chartMinY : undefined
|
|
142
|
+
};
|
|
143
|
+
const colorScale = this.state.colors.length === 1 ? this.state.colors[0] : this.state.colors;
|
|
144
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
145
|
+
style: this.styles.root,
|
|
146
|
+
onLayout: this.onViewLayoutChange
|
|
147
|
+
}, props.viewtype === 'Bar' ? /*#__PURE__*/React.createElement(VictoryChart, {
|
|
148
|
+
theme: this.state.theme,
|
|
149
|
+
minDomain: mindomain,
|
|
150
|
+
height: this.styles.root.height,
|
|
151
|
+
width: this.styles.root.width || this.screenWidth,
|
|
152
|
+
padding: {
|
|
153
|
+
top: props.offsettop,
|
|
154
|
+
bottom: props.offsetbottom,
|
|
155
|
+
left: props.offsetleft,
|
|
156
|
+
right: props.offsetright
|
|
157
|
+
}
|
|
158
|
+
}, /*#__PURE__*/React.createElement(VictoryLegend, {
|
|
159
|
+
name: 'legend',
|
|
160
|
+
containerComponent: /*#__PURE__*/React.createElement(Svg, null),
|
|
161
|
+
style: {
|
|
162
|
+
title: {
|
|
163
|
+
fontFamily: "'Helvetica Neue', 'Helvetica', sans-serif",
|
|
164
|
+
fontSize: 18
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
title: [props.title, props.subheading],
|
|
168
|
+
orientation: "horizontal",
|
|
169
|
+
gutter: 20,
|
|
170
|
+
data: [],
|
|
171
|
+
theme: this.state.theme
|
|
172
|
+
}), this.getLegendView(colorScale), /*#__PURE__*/React.createElement(VictoryAxis, {
|
|
173
|
+
crossAxis: true,
|
|
174
|
+
style: {
|
|
175
|
+
tickLabels: {
|
|
176
|
+
fill: this.state.props.showyaxis === false ? 'transparent' : '#000000',
|
|
177
|
+
fontSize: 12,
|
|
178
|
+
padding: this.state.props.thickness / 2 + 5
|
|
179
|
+
},
|
|
180
|
+
axisLabel: {
|
|
181
|
+
padding: 15 + this.state.props.thickness / 2
|
|
182
|
+
},
|
|
183
|
+
grid: {
|
|
184
|
+
stroke: 'none'
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
theme: this.state.theme,
|
|
188
|
+
tickValues: this.getTickValues(),
|
|
189
|
+
tickFormat: t => this.state.props.yunits ? `${this.abbreviateNumber(t)}${this.state.props.yunits}` : `${this.abbreviateNumber(t)}`,
|
|
190
|
+
dependentAxis: true
|
|
191
|
+
}), /*#__PURE__*/React.createElement(VictoryStack, {
|
|
192
|
+
colorScale: colorScale,
|
|
193
|
+
horizontal: true,
|
|
194
|
+
style: {
|
|
195
|
+
data: {
|
|
196
|
+
strokeWidth: this.state.props.thickness
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}, this.getBarChart(props))) : /*#__PURE__*/React.createElement(Svg, {
|
|
200
|
+
width: this.state.chartWidth,
|
|
201
|
+
height: this.state.chartHeight
|
|
202
|
+
}, /*#__PURE__*/React.createElement(VictoryLegend, {
|
|
203
|
+
name: 'legend',
|
|
204
|
+
containerComponent: /*#__PURE__*/React.createElement(Svg, null),
|
|
205
|
+
title: [props.title, props.subheading],
|
|
206
|
+
orientation: "horizontal",
|
|
207
|
+
gutter: 20,
|
|
208
|
+
data: [],
|
|
209
|
+
theme: this.state.theme
|
|
210
|
+
}), this.getArcChart(props), this.getArcAxis()));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=stack-chart.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","View","Svg","VictoryStack","VictoryBar","VictoryChart","VictoryPie","VictoryLegend","VictoryAxis","Axis","Scale","orderBy","cloneDeep","WmStackChartProps","DEFAULT_CLASS","BaseChartComponent","BaseChartComponentState","WmStackChartState","constructor","arguments","_defineProperty","WmStackChart","props","e","viewWidth","nativeEvent","layout","width","updateState","chartWidth","componentDidMount","setHeightWidthOnChart","getBarChart","state","data","length","currentValue","map","d","i","d1","x","y","push","createElement","key","name","cornerRadius","bottomLeft","bottomRight","topLeft","topRight","getColorCodes","colors","reverse","getArcChart","colorScaleArray","maxValue","Math","max","o","radius","colorScale","startAngle","endAngle","standalone","origin","chartHeight","innerRadius","thickness","labels","getArcAxis","ticks","getTickValues","axisData","forEach","yunits","style","fontSize","paddingLeft","paddingRight","labelRadius","scale","getBaseScale","domain","getTicks","renderWidget","mindomain","xdomain","chartMinX","undefined","ydomain","chartMinY","styles","root","onLayout","onViewLayoutChange","viewtype","theme","minDomain","height","screenWidth","padding","top","offsettop","bottom","offsetbottom","left","offsetleft","right","offsetright","containerComponent","title","fontFamily","subheading","orientation","gutter","getLegendView","crossAxis","tickLabels","fill","showyaxis","axisLabel","grid","stroke","tickValues","tickFormat","t","abbreviateNumber","dependentAxis","horizontal","strokeWidth"],"sources":["stack-chart.component.tsx"],"sourcesContent":["import React from 'react';\nimport { LayoutChangeEvent, View } from 'react-native';\nimport { Svg } from 'react-native-svg';\nimport { VictoryStack, VictoryBar, VictoryChart, VictoryPie, VictoryLegend, VictoryAxis } from 'victory-native';\nimport { Axis, Scale } from 'victory-core';\nimport { orderBy, cloneDeep } from 'lodash';\n\nimport WmStackChartProps from './stack-chart.props';\nimport { DEFAULT_CLASS, WmStackChartStyles } from './stack-chart.styles';\nimport {\n BaseChartComponent,\n BaseChartComponentState\n} from '@wavemaker/app-rn-runtime/components/chart/basechart.component';\n\nexport class WmStackChartState extends BaseChartComponentState<WmStackChartProps> {\n chartWidth = 0;\n}\n\nexport default class WmStackChart extends BaseChartComponent<WmStackChartProps, WmStackChartState, WmStackChartStyles> {\n constructor(props: WmStackChartProps) {\n super(props, DEFAULT_CLASS, new WmStackChartProps(), new WmStackChartState());\n }\n\n componentDidMount() {\n super.componentDidMount();\n this.setHeightWidthOnChart();\n }\n\n getBarChart(props: WmStackChartProps) {\n if ( this.state.data.length >0 ) {\n let data = cloneDeep(this.state.data[0]);\n data = orderBy(data, 'y', 'asc');\n let currentValue = 0;\n return data.map((d: any, i: number) => {\n let d1: any = [];\n d.x = 0;\n d.y = d.y - currentValue;\n d1.push(d);\n currentValue = d.y + currentValue;\n return <VictoryBar key={props.name + '_' + i}\n cornerRadius={{bottomLeft:(3), bottomRight:(3), topLeft:(3), topRight:(3)}}\n data={d1}/>\n });\n }\n }\n\n private getColorCodes() {\n const colors = cloneDeep(this.state.colors);\n return colors.reverse();\n }\n\n getArcChart(props: WmStackChartProps) {\n if ( this.state.data.length > 0 ) {\n let data = cloneDeep(this.state.data[0]);\n const colorScaleArray = this.getColorCodes();\n const maxValue = Math.max(...data.map((o: any) => o.y));\n data = orderBy(data, 'y', 'desc');\n const radius = 170;\n return data.map((d: any, i: number) => {\n let d1: any = [];\n d1.push(d);\n d1.push({x: d.x, y: maxValue - d.y})\n return <VictoryPie key={props.name + '_' + i}\n radius={radius}\n colorScale={[colorScaleArray[i], '#fff0']}\n startAngle={-80}\n endAngle={80}\n cornerRadius={100}\n standalone={false}\n origin={{x: (this.state.chartWidth/2), y: (this.state.chartHeight - 50)}}\n innerRadius={radius - this.state.props.thickness}\n labels={[]}\n data={d1}/>\n });\n }\n }\n\n getArcAxis() {\n const ticks = this.getTickValues();\n const radius = 170;\n const axisData: any = [];\n ticks.forEach((d: any, i: any) => {\n axisData.push({x: `${this.state.props.yunits}${d}`, y: 1})\n });\n return <VictoryPie\n style={{\n labels: {\n fontSize: 12, paddingLeft: 50, paddingRight: 80\n }}\n }\n startAngle={-90}\n endAngle={90}\n standalone={false}\n colorScale={['#fff0']}\n origin={{x: (this.state.chartWidth/2 - 5), y: (this.state.chartHeight - 50)}}\n labelRadius={radius - this.state.props.thickness - 20}\n data={axisData}\n />\n }\n\n onViewLayoutChange = (e: LayoutChangeEvent) => {\n let viewWidth = e.nativeEvent.layout.width;\n this.updateState({\n chartWidth: viewWidth\n } as WmStackChartState);\n }\n\n getTickValues() {\n let ticks: any = [];\n if (this.state.data[0].length) {\n let data = cloneDeep(this.state.data[0]);\n const maxValue = Math.max(...data.map((o: any) => o.y));\n const scale = Scale.getBaseScale({}, 'x');\n scale.domain([0, maxValue]);\n ticks = Axis.getTicks({}, scale);\n }\n return ticks;\n }\n\n renderWidget(props: WmStackChartProps) {\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 const colorScale = this.state.colors.length === 1 ? this.state.colors[0] : this.state.colors;\n return (\n <View\n style={this.styles.root} onLayout={this.onViewLayoutChange}\n >{\n props.viewtype === 'Bar' ?\n <VictoryChart\n theme={this.state.theme}\n minDomain={mindomain}\n height={this.styles.root.height as number}\n width={this.styles.root.width as number || this.screenWidth}\n padding={{\n top: props.offsettop,\n bottom: props.offsetbottom,\n left: props.offsetleft,\n right: props.offsetright\n }}>\n <VictoryLegend\n name={'legend'}\n containerComponent={<Svg />}\n style={{title: {\n fontFamily: \"'Helvetica Neue', 'Helvetica', sans-serif\",\n fontSize: 18\n }\n }}\n title={[props.title, props.subheading]}\n orientation=\"horizontal\"\n gutter={20}\n data={[]}\n theme={this.state.theme}\n />\n {this.getLegendView(colorScale)}\n <VictoryAxis crossAxis\n style={{\n tickLabels: { fill: this.state.props.showyaxis === false ? 'transparent' : '#000000', fontSize: 12, padding: this.state.props.thickness/2 + 5},\n axisLabel: { padding: (15 + this.state.props.thickness/2) },\n grid: {stroke: 'none'}\n }}\n theme={this.state.theme}\n tickValues={this.getTickValues()}\n tickFormat={(t) => this.state.props.yunits ? `${this.abbreviateNumber(t)}${this.state.props.yunits}` : `${this.abbreviateNumber(t)}`} dependentAxis />\n <VictoryStack\n colorScale={colorScale}\n horizontal={true}\n style={{\n data: { strokeWidth: this.state.props.thickness }\n }}\n >\n {\n this.getBarChart(props)\n }\n </VictoryStack>\n </VictoryChart> :\n <Svg width={this.state.chartWidth} height={this.state.chartHeight}>\n <VictoryLegend\n name={'legend'}\n containerComponent={<Svg />}\n title={[props.title, props.subheading]}\n orientation=\"horizontal\"\n gutter={20}\n data={[]}\n theme={this.state.theme}\n />\n {this.getArcChart(props)}\n {this.getArcAxis()}\n </Svg>\n }\n </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H,CAAC;EAEX;AACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
|
+
import BaseChartComponentProps from '@wavemaker/app-rn-runtime/components/chart/basechart.props';
|
|
5
|
+
export default class WmStackChartProps extends BaseChartComponentProps {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
_defineProperty(this, "viewtype", 'Bar');
|
|
9
|
+
_defineProperty(this, "showlegend", 'left');
|
|
10
|
+
_defineProperty(this, "thickness", 20);
|
|
11
|
+
_defineProperty(this, "offsetleft", 25);
|
|
12
|
+
_defineProperty(this, "offsetright", 35);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=stack-chart.props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BaseChartComponentProps","WmStackChartProps","constructor","arguments","_defineProperty"],"sources":["stack-chart.props.ts"],"sourcesContent":["import BaseChartComponentProps from '@wavemaker/app-rn-runtime/components/chart/basechart.props';\n\nexport default class WmStackChartProps extends BaseChartComponentProps {\n viewtype: string = 'Bar';\n showlegend: string = 'left';\n thickness: number = 20;\n offsetleft: number = 25;\n offsetright: number = 35;\n}\n"],"mappings":";;;AAAA,OAAOA,uBAAuB,MAAM,4DAA4D;AAEhG,eAAe,MAAMC,iBAAiB,SAASD,uBAAuB,CAAC;EAAAE,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA,mBAClD,KAAK;IAAAA,eAAA,qBACH,MAAM;IAAAA,eAAA,oBACP,EAAE;IAAAA,eAAA,qBACD,EAAE;IAAAA,eAAA,sBACD,EAAE;EAAA;AAC1B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import BASE_THEME from '@wavemaker/app-rn-runtime/styles/theme';
|
|
2
|
+
import { DEFAULT_CLASS as BASE_CHART_DEFAULT_CLASS } from '../basechart.styles';
|
|
3
|
+
export const DEFAULT_CLASS = 'app-stack-chart';
|
|
4
|
+
BASE_THEME.registerStyle((themeVariables, addStyle) => {
|
|
5
|
+
addStyle(DEFAULT_CLASS, BASE_CHART_DEFAULT_CLASS, {});
|
|
6
|
+
});
|
|
7
|
+
//# sourceMappingURL=stack-chart.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BASE_THEME","DEFAULT_CLASS","BASE_CHART_DEFAULT_CLASS","registerStyle","themeVariables","addStyle"],"sources":["stack-chart.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 {BaseChartComponentStyles, DEFAULT_CLASS as BASE_CHART_DEFAULT_CLASS } from '../basechart.styles';\n\nexport type WmStackChartStyles = BaseStyles & BaseChartComponentStyles;\n\nexport const DEFAULT_CLASS = 'app-stack-chart';\nBASE_THEME.registerStyle((themeVariables, addStyle) => {\n addStyle(DEFAULT_CLASS, BASE_CHART_DEFAULT_CLASS, {});\n});\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,wCAAwC;AAE/D,SAAkCC,aAAa,IAAIC,wBAAwB,QAAQ,qBAAqB;AAIxG,OAAO,MAAMD,aAAa,GAAG,iBAAiB;AAC9CD,UAAU,CAACG,aAAa,CAAC,CAACC,cAAc,EAAEC,QAAQ,KAAK;EACrDA,QAAQ,CAACJ,aAAa,EAAEC,wBAAwB,EAAE,CAAC,CAAC,CAAC;AACvD,CAAC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
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); }
|
|
1
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; }
|
|
2
3
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
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); }
|
|
@@ -24,12 +25,16 @@ export default class WmAccordion extends BaseComponent {
|
|
|
24
25
|
_defineProperty(this, "newIndex", 0);
|
|
25
26
|
}
|
|
26
27
|
addAccordionPane(accordionPane) {
|
|
27
|
-
|
|
28
|
+
var _this$state$isExpande;
|
|
29
|
+
const i = this.accordionPanes.findIndex(t => t.props.title === accordionPane.props.title);
|
|
28
30
|
if (i >= 0) {
|
|
29
31
|
this.accordionPanes[i] = accordionPane;
|
|
30
32
|
} else {
|
|
31
33
|
this.accordionPanes[this.newIndex++] = accordionPane;
|
|
32
34
|
}
|
|
35
|
+
if (!((_this$state$isExpande = this.state.isExpanded) !== null && _this$state$isExpande !== void 0 && _this$state$isExpande.find(v => v))) {
|
|
36
|
+
this.toggle(this.state.props.defaultpaneindex + 1);
|
|
37
|
+
}
|
|
33
38
|
}
|
|
34
39
|
expand(accordionName) {
|
|
35
40
|
const i = this.accordionPanes.findIndex(t => t.props.name === accordionName);
|
|
@@ -39,16 +44,16 @@ export default class WmAccordion extends BaseComponent {
|
|
|
39
44
|
const i = this.accordionPanes.findIndex(t => t.props.name === accordionName);
|
|
40
45
|
this.toggle(i + 1, false);
|
|
41
46
|
}
|
|
42
|
-
expandCollapseIcon(item) {
|
|
43
|
-
let showBadge = arguments.length >
|
|
44
|
-
let showIcon = arguments.length >
|
|
45
|
-
let useChevron = arguments.length >
|
|
46
|
-
let isExpanded = arguments.length >
|
|
47
|
+
expandCollapseIcon(item, index) {
|
|
48
|
+
let showBadge = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
49
|
+
let showIcon = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
50
|
+
let useChevron = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
51
|
+
let isExpanded = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
47
52
|
const widgetProps = item.props;
|
|
48
53
|
//@ts-ignore
|
|
49
|
-
const badge = showBadge && widgetProps.badgevalue != undefined ? /*#__PURE__*/React.createElement(Badge, {
|
|
54
|
+
const badge = showBadge && widgetProps.badgevalue != undefined ? /*#__PURE__*/React.createElement(Badge, _extends({
|
|
50
55
|
style: [this.styles.badge, isExpanded ? this.styles.activeBadge : null, this.styles[widgetProps.badgetype || 'default']]
|
|
51
|
-
}, widgetProps.badgevalue) : null;
|
|
56
|
+
}, this.getTestProps('badge' + index)), widgetProps.badgevalue) : null;
|
|
52
57
|
let iconclass = null;
|
|
53
58
|
if (useChevron) {
|
|
54
59
|
iconclass = isExpanded ? 'wi wi-chevron-down' : 'wi wi-chevron-up';
|
|
@@ -60,6 +65,7 @@ export default class WmAccordion extends BaseComponent {
|
|
|
60
65
|
flexDirection: 'row'
|
|
61
66
|
}
|
|
62
67
|
}, badge, showIcon ? /*#__PURE__*/React.createElement(WmIcon, {
|
|
68
|
+
id: this.getTestId('icon' + index),
|
|
63
69
|
styles: this.theme.mergeStyle({}, this.styles.icon, isExpanded ? this.styles.activeIcon : null),
|
|
64
70
|
name: 'expand_collapse_icon',
|
|
65
71
|
iconclass: iconclass
|
|
@@ -71,12 +77,13 @@ export default class WmAccordion extends BaseComponent {
|
|
|
71
77
|
const isExpanded = this.state.isExpanded[index];
|
|
72
78
|
return /*#__PURE__*/React.createElement(View, {
|
|
73
79
|
style: this.styles.pane,
|
|
74
|
-
key: item.props.
|
|
75
|
-
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
76
|
-
key: 'accordionpane_' + (index + 1)
|
|
80
|
+
key: item.props.title
|
|
81
|
+
}, /*#__PURE__*/React.createElement(TouchableOpacity, _extends({
|
|
82
|
+
key: 'accordionpane_' + (index + 1)
|
|
83
|
+
}, this.getTestPropsForAction(`header${index}`), {
|
|
77
84
|
style: [this.styles.header, index === 0 ? this.styles.firstHeader : null, index === accordionpanes.length - 1 && !isExpanded ? this.styles.lastHeader : null, isExpanded ? this.styles.activeHeader : {}],
|
|
78
85
|
onPress: this.toggle.bind(this, index + 1, !isExpanded)
|
|
79
|
-
}, this.expandCollapseIcon(item, false, showIconOnLeft, true, isExpanded), item.props.iconclass ? /*#__PURE__*/React.createElement(WmIcon, {
|
|
86
|
+
}), this.expandCollapseIcon(item, index, false, showIconOnLeft, true, isExpanded), item.props.iconclass ? /*#__PURE__*/React.createElement(WmIcon, {
|
|
80
87
|
styles: this.styles.icon,
|
|
81
88
|
name: item.props.name + '_icon',
|
|
82
89
|
iconclass: item.props.iconclass
|
|
@@ -86,11 +93,11 @@ export default class WmAccordion extends BaseComponent {
|
|
|
86
93
|
flex: 1,
|
|
87
94
|
justifyContent: 'center'
|
|
88
95
|
}
|
|
89
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
96
|
+
}, /*#__PURE__*/React.createElement(Text, _extends({
|
|
90
97
|
style: [this.styles.text, this.styles.heading, isExpanded ? this.styles.activeHeaderTitle : {}]
|
|
91
|
-
}, isDefined(item.props.title) ? item.props.title : 'Title'), item.props.description ? /*#__PURE__*/React.createElement(Text, {
|
|
98
|
+
}, this.getTestPropsForAction(`header${index}_title`)), isDefined(item.props.title) ? item.props.title : 'Title'), item.props.description ? /*#__PURE__*/React.createElement(Text, _extends({
|
|
92
99
|
style: this.styles.subheading
|
|
93
|
-
}, item.props.description) : null), this.expandCollapseIcon(item, true, !showIconOnLeft, true, isExpanded)), item);
|
|
100
|
+
}, this.getTestPropsForAction(`header${index}_description`)), item.props.description) : null), this.expandCollapseIcon(item, index, true, !showIconOnLeft, true, isExpanded)), item);
|
|
94
101
|
}
|
|
95
102
|
toggle(index) {
|
|
96
103
|
let expand = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Text","TouchableOpacity","View","Badge","isArray","BaseComponent","BaseComponentState","WmAccordionProps","DEFAULT_CLASS","WmIcon","isDefined","WmAccordionState","constructor","arguments","_defineProperty","WmAccordion","props","addAccordionPane","accordionPane","i","accordionPanes","findIndex","t","name","newIndex","expand","accordionName","toggle","collapse","expandCollapseIcon","item","showBadge","length","undefined","showIcon","useChevron","isExpanded","widgetProps","badge","badgevalue","createElement","style","styles","activeBadge","badgetype","iconclass","flexDirection","theme","mergeStyle","icon","activeIcon","renderAccordionpane","index","accordionpanes","showIconOnLeft","leftToggleIcon","root","width","state","pane","key","header","firstHeader","lastHeader","activeHeader","onPress","bind","flex","justifyContent","text","heading","activeHeaderTitle","title","description","subheading","expandedId","collapseId","closeothers","lastExpandedIndex","collapsedPane","hide","Promise","resolve","then","expandedPane","show","setState","invokeEventCallback","proxy","componentDidMount","defaultpaneindex","renderWidget","children","_background","map"],"sources":["accordion.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, TouchableOpacity, View } from 'react-native';\nimport { Badge } from 'react-native-paper';\nimport { isArray } from 'lodash';\n\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport WmAccordionProps from './accordion.props';\nimport { DEFAULT_CLASS, WmAccordionStyles } from './accordion.styles';\nimport WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';\nimport WmAccordionpane from './accordionpane/accordionpane.component';\nimport { isDefined } from '@wavemaker/app-rn-runtime/core/utils';\n\nexport class WmAccordionState extends BaseComponentState<WmAccordionProps> {\n lastExpandedIndex = -1;\n isExpanded = [] as boolean[];\n}\n\nexport default class WmAccordion extends BaseComponent<WmAccordionProps, WmAccordionState, WmAccordionStyles> {\n public accordionPanes = [] as WmAccordionpane[];\n private newIndex = 0;\n\n constructor(props: WmAccordionProps) {\n super(props, DEFAULT_CLASS, new WmAccordionProps(), new WmAccordionState());\n }\n\n addAccordionPane(accordionPane: WmAccordionpane) {\n const i = this.accordionPanes.findIndex(t => t.props.name === accordionPane.props.name);\n if (i >= 0) {\n this.accordionPanes[i] = accordionPane;\n } else {\n this.accordionPanes[this.newIndex++] = accordionPane;\n }\n }\n\n expand(accordionName: string) {\n const i = this.accordionPanes.findIndex(t => t.props.name === accordionName);\n this.toggle(i + 1, true);\n }\n\n collapse(accordionName: string) {\n const i = this.accordionPanes.findIndex(t => t.props.name === accordionName);\n this.toggle(i + 1, false);\n }\n\n expandCollapseIcon(item: any, showBadge = true, showIcon = true, useChevron = true, isExpanded = false) {\n const widgetProps = item.props;\n //@ts-ignore\n const badge = showBadge && widgetProps.badgevalue != undefined ? (\n <Badge style={[\n this.styles.badge,\n isExpanded ? this.styles.activeBadge: null,\n this.styles[widgetProps.badgetype || 'default']]}>\n {widgetProps.badgevalue}\n </Badge>): null;\n let iconclass = null;\n if (useChevron) {\n iconclass = isExpanded ? 'wi wi-chevron-down' : 'wi wi-chevron-up';\n } else {\n iconclass = isExpanded ? 'wi wi-minus' : 'wi wi-plus';\n }\n return (<View style={{flexDirection: 'row'}}>\n {badge}\n {showIcon ? (\n <WmIcon\n styles={this.theme.mergeStyle({}, this.styles.icon, isExpanded ? this.styles.activeIcon : null)}\n name={'expand_collapse_icon'}\n iconclass={iconclass}></WmIcon>): null}\n </View>);\n }\n\n renderAccordionpane(item: any, index: any, accordionpanes: any[] = []) {\n const showIconOnLeft = this.styles.leftToggleIcon.root.width !== undefined;\n const isExpanded = this.state.isExpanded[index];\n return (\n <View style={this.styles.pane} key={item.props.name}>\n <TouchableOpacity key={'accordionpane_' + (index + 1)}\n style={[this.styles.header,\n index === 0 ? this.styles.firstHeader: null,\n index === accordionpanes.length - 1 && !isExpanded ? this.styles.lastHeader: null,\n isExpanded ? this.styles.activeHeader : {}]}\n onPress={this.toggle.bind(this, index + 1, !isExpanded)}>\n {this.expandCollapseIcon(item, false, showIconOnLeft, true, isExpanded)}\n {item.props.iconclass ? <WmIcon styles={this.styles.icon} name={item.props.name + '_icon'} iconclass={item.props.iconclass}></WmIcon>: null}\n <View style={{flexDirection: 'column', flex: 1, justifyContent: 'center'}}>\n <Text style={[\n this.styles.text,\n this.styles.heading,\n isExpanded ? this.styles.activeHeaderTitle : {}]}>\n {isDefined(item.props.title) ? item.props.title : 'Title'}\n </Text>\n {item.props.description ? \n (<Text style={this.styles.subheading}>{item.props.description}</Text>) : null }\n </View>\n {this.expandCollapseIcon(item, true, !showIconOnLeft, true, isExpanded)}\n </TouchableOpacity>\n {item}\n </View>\n );\n }\n\n toggle(index: number, expand = true) {\n let expandedId = expand ? index : -1;\n let collapseId = expand ? -1 : index;\n if (expand && this.state.isExpanded[expandedId - 1]\n || !expand && this.state.isExpanded[collapseId - 1] === false) {\n return;\n }\n if (collapseId < 0 && this.state.props.closeothers) {\n collapseId = this.state.lastExpandedIndex;\n }\n const collapsedPane = this.accordionPanes[collapseId -1];\n collapsedPane?.hide();\n Promise.resolve().then(() => {\n const expandedPane = expandedId ? this.accordionPanes[expandedId - 1]: null;\n expandedPane?.show();\n this.setState((state) => {\n if (collapseId > 0 && collapsedPane) {\n state.isExpanded[collapseId - 1] = false;\n }\n if (expandedId > 0 && expandedPane) {\n state.isExpanded[expandedId - 1] = true;\n }\n return {\n lastExpandedIndex: expandedId,\n isExpanded: [...state.isExpanded]\n };\n }, () => {\n this.invokeEventCallback('onChange', [{},\n this.proxy,\n expandedId - 1,\n collapseId ? collapseId - 1 : null,\n expandedPane && expandedPane.props.name,\n collapsedPane && collapsedPane.props.name]);\n });\n }, () => {});\n }\n\n public componentDidMount(): void {\n super.componentDidMount();\n this.toggle(this.state.props.defaultpaneindex + 1);\n }\n\n renderWidget(props: WmAccordionProps) {\n const accordionpanes = props.children;\n const expandedId = this.state.lastExpandedIndex || 0;\n return (\n <View style={this.styles.root}>\n {this._background}\n {accordionpanes\n ? isArray(accordionpanes) && accordionpanes.length\n ? accordionpanes.map((item: any, index: any) => this.renderAccordionpane(item, index, accordionpanes))\n : this.renderAccordionpane(accordionpanes, 0)\n : null}\n </View>\n );\n }\n}\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AAC3D,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,OAAO,QAAQ,QAAQ;AAEhC,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AACjG,OAAOC,gBAAgB,MAAM,mBAAmB;AAChD,SAASC,aAAa,QAA2B,oBAAoB;AACrE,OAAOC,MAAM,MAAM,gEAAgE;AAEnF,SAASC,SAAS,QAAQ,sCAAsC;AAEhE,OAAO,MAAMC,gBAAgB,SAASL,kBAAkB,CAAmB;EAAAM,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA,4BACrD,CAAC,CAAC;IAAAA,eAAA,qBACT,EAAE;EAAA;AACjB;AAEA,eAAe,MAAMC,WAAW,SAASV,aAAa,CAAwD;EAI5GO,WAAWA,CAACI,KAAuB,EAAE;IACnC,KAAK,CAACA,KAAK,EAAER,aAAa,EAAE,IAAID,gBAAgB,CAAC,CAAC,EAAE,IAAII,gBAAgB,CAAC,CAAC,CAAC;IAACG,eAAA,yBAJtD,EAAE;IAAAA,eAAA,mBACP,CAAC;EAIpB;EAEAG,gBAAgBA,CAACC,aAA8B,EAAE;I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IAAIA,aAAa,CAAC/D,KAAK,CAACO,IAAI,CAAC,CAAC;MAC7C,CAAC,CAAC;IACN,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;EACd;EAEOkE,iBAAiBA,CAAA,EAAS;IAC7B,KAAK,CAACA,iBAAiB,CAAC,CAAC;IACzB,IAAI,CAAC9D,MAAM,CAAC,IAAI,CAAC+B,KAAK,CAAC1C,KAAK,CAAC0E,gBAAgB,GAAG,CAAC,CAAC;EACtD;EAEAC,YAAYA,CAAC3E,KAAuB,EAAE;IACpC,MAAMqC,cAAc,GAAGrC,KAAK,CAAC4E,QAAQ;IACrC,MAAMjB,UAAU,GAAG,IAAI,CAACjB,KAAK,CAACoB,iBAAiB,IAAI,CAAC;IACpD,oBACI/E,KAAA,CAAAyC,aAAA,CAACtC,IAAI;MAACuC,KAAK,EAAE,IAAI,CAACC,MAAM,CAACc;IAAK,GAC3B,IAAI,CAACqC,WAAW,EACdxC,cAAc,GACXjD,OAAO,CAACiD,cAAc,CAAC,IAAIA,cAAc,CAACrB,MAAM,GAC9CqB,cAAc,CAACyC,GAAG,CAAC,CAAChE,IAAS,EAAEsB,KAAU,KAAK,IAAI,CAACD,mBAAmB,CAACrB,IAAI,EAAEsB,KAAK,EAAEC,cAAc,CAAC,CAAC,GACpG,IAAI,CAACF,mBAAmB,CAACE,cAAc,EAAE,CAAC,CAAC,GAC7C,IACF,CAAC;EAEb;AACF"}
|
|
1
|
+
{"version":3,"names":["React","Text","TouchableOpacity","View","Badge","isArray","BaseComponent","BaseComponentState","WmAccordionProps","DEFAULT_CLASS","WmIcon","isDefined","WmAccordionState","constructor","arguments","_defineProperty","WmAccordion","props","addAccordionPane","accordionPane","_this$state$isExpande","i","accordionPanes","findIndex","t","title","newIndex","state","isExpanded","find","v","toggle","defaultpaneindex","expand","accordionName","name","collapse","expandCollapseIcon","item","index","showBadge","length","undefined","showIcon","useChevron","widgetProps","badge","badgevalue","createElement","_extends","style","styles","activeBadge","badgetype","getTestProps","iconclass","flexDirection","id","getTestId","theme","mergeStyle","icon","activeIcon","renderAccordionpane","accordionpanes","showIconOnLeft","leftToggleIcon","root","width","pane","key","getTestPropsForAction","header","firstHeader","lastHeader","activeHeader","onPress","bind","flex","justifyContent","text","heading","activeHeaderTitle","description","subheading","expandedId","collapseId","closeothers","lastExpandedIndex","collapsedPane","hide","Promise","resolve","then","expandedPane","show","setState","invokeEventCallback","proxy","componentDidMount","renderWidget","children","_background","map"],"sources":["accordion.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, TouchableOpacity, View } from 'react-native';\nimport { Badge } from 'react-native-paper';\nimport { isArray } from 'lodash';\n\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport WmAccordionProps from './accordion.props';\nimport { DEFAULT_CLASS, WmAccordionStyles } from './accordion.styles';\nimport WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';\nimport WmAccordionpane from './accordionpane/accordionpane.component';\nimport { isDefined } from '@wavemaker/app-rn-runtime/core/utils';\n\nexport class WmAccordionState extends BaseComponentState<WmAccordionProps> {\n lastExpandedIndex = -1;\n isExpanded = [] as boolean[];\n}\n\nexport default class WmAccordion extends BaseComponent<WmAccordionProps, WmAccordionState, WmAccordionStyles> {\n public accordionPanes = [] as WmAccordionpane[];\n private newIndex = 0;\n\n constructor(props: WmAccordionProps) {\n super(props, DEFAULT_CLASS, new WmAccordionProps(), new WmAccordionState());\n }\n\n addAccordionPane(accordionPane: WmAccordionpane) {\n const i = this.accordionPanes.findIndex(t => t.props.title === accordionPane.props.title);\n if (i >= 0) {\n this.accordionPanes[i] = accordionPane;\n } else {\n this.accordionPanes[this.newIndex++] = accordionPane;\n }\n if (!(this.state.isExpanded?.find((v) => v))) {\n this.toggle(this.state.props.defaultpaneindex + 1);\n }\n }\n\n expand(accordionName: string) {\n const i = this.accordionPanes.findIndex(t => t.props.name === accordionName);\n this.toggle(i + 1, true);\n }\n\n collapse(accordionName: string) {\n const i = this.accordionPanes.findIndex(t => t.props.name === accordionName);\n this.toggle(i + 1, false);\n }\n\n expandCollapseIcon(item: any, index: number, showBadge = true, showIcon = true, useChevron = true, isExpanded = false) {\n const widgetProps = item.props;\n //@ts-ignore\n const badge = showBadge && widgetProps.badgevalue != undefined ? (\n <Badge style={[\n this.styles.badge,\n isExpanded ? this.styles.activeBadge: null,\n this.styles[widgetProps.badgetype || 'default']]}\n {...this.getTestProps('badge'+index)}>\n {widgetProps.badgevalue}\n </Badge>): null;\n let iconclass = null;\n if (useChevron) {\n iconclass = isExpanded ? 'wi wi-chevron-down' : 'wi wi-chevron-up';\n } else {\n iconclass = isExpanded ? 'wi wi-minus' : 'wi wi-plus';\n }\n return (<View style={{flexDirection: 'row'}}>\n {badge}\n {showIcon ? (\n <WmIcon\n id={this.getTestId('icon' + index)}\n styles={this.theme.mergeStyle({}, this.styles.icon, isExpanded ? this.styles.activeIcon : null)}\n name={'expand_collapse_icon'}\n iconclass={iconclass}></WmIcon>): null}\n </View>);\n }\n\n renderAccordionpane(item: any, index: any, accordionpanes: any[] = []) {\n const showIconOnLeft = this.styles.leftToggleIcon.root.width !== undefined;\n const isExpanded = this.state.isExpanded[index];\n return (\n <View style={this.styles.pane} key={item.props.title}>\n <TouchableOpacity key={'accordionpane_' + (index + 1)}\n {...this.getTestPropsForAction(`header${index}`)}\n style={[this.styles.header,\n index === 0 ? this.styles.firstHeader: null,\n index === accordionpanes.length - 1 && !isExpanded ? this.styles.lastHeader: null,\n isExpanded ? this.styles.activeHeader : {}]}\n onPress={this.toggle.bind(this, index + 1, !isExpanded)}>\n {this.expandCollapseIcon(item, index, false, showIconOnLeft, true, isExpanded)}\n {item.props.iconclass ? <WmIcon styles={this.styles.icon} name={item.props.name + '_icon'} iconclass={item.props.iconclass}></WmIcon>: null}\n <View style={{flexDirection: 'column', flex: 1, justifyContent: 'center'}}>\n <Text style={[\n this.styles.text,\n this.styles.heading,\n isExpanded ? this.styles.activeHeaderTitle : {}]}\n {...this.getTestPropsForAction(`header${index}_title`)}>\n {isDefined(item.props.title) ? item.props.title : 'Title'}\n </Text>\n {item.props.description ? \n (<Text style={this.styles.subheading}\n {...this.getTestPropsForAction(`header${index}_description`)}>{item.props.description}</Text>) : null }\n </View>\n {this.expandCollapseIcon(item, index, true, !showIconOnLeft, true, isExpanded)}\n </TouchableOpacity>\n {item}\n </View>\n );\n }\n\n toggle(index: number, expand = true) {\n let expandedId = expand ? index : -1;\n let collapseId = expand ? -1 : index;\n if (expand && this.state.isExpanded[expandedId - 1]\n || !expand && this.state.isExpanded[collapseId - 1] === false) {\n return;\n }\n if (collapseId < 0 && this.state.props.closeothers) {\n collapseId = this.state.lastExpandedIndex;\n }\n const collapsedPane = this.accordionPanes[collapseId -1];\n collapsedPane?.hide();\n Promise.resolve().then(() => {\n const expandedPane = expandedId ? this.accordionPanes[expandedId - 1]: null;\n expandedPane?.show();\n this.setState((state) => {\n if (collapseId > 0 && collapsedPane) {\n state.isExpanded[collapseId - 1] = false;\n }\n if (expandedId > 0 && expandedPane) {\n state.isExpanded[expandedId - 1] = true;\n }\n return {\n lastExpandedIndex: expandedId,\n isExpanded: [...state.isExpanded]\n };\n }, () => {\n this.invokeEventCallback('onChange', [{},\n this.proxy,\n expandedId - 1,\n collapseId ? collapseId - 1 : null,\n expandedPane && expandedPane.props.name,\n collapsedPane && collapsedPane.props.name]);\n });\n }, () => {});\n }\n\n public componentDidMount(): void {\n super.componentDidMount();\n this.toggle(this.state.props.defaultpaneindex + 1);\n }\n\n renderWidget(props: WmAccordionProps) {\n const accordionpanes = props.children;\n const expandedId = this.state.lastExpandedIndex || 0;\n return (\n <View style={this.styles.root}>\n {this._background}\n {accordionpanes\n ? isArray(accordionpanes) && accordionpanes.length\n ? accordionpanes.map((item: any, index: any) => this.renderAccordionpane(item, index, accordionpanes))\n : this.renderAccordionpane(accordionpanes, 0)\n : null}\n </View>\n );\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,I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I,CAACqE,mBAAmB,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EACtC,IAAI,CAACC,KAAK,EACVb,UAAU,GAAG,CAAC,EACdC,UAAU,GAAGA,UAAU,GAAG,CAAC,GAAG,IAAI,EAClCQ,YAAY,IAAIA,YAAY,CAAC7E,KAAK,CAACkB,IAAI,EACvCsD,aAAa,IAAIA,aAAa,CAACxE,KAAK,CAACkB,IAAI,CAAC,CAAC;MAC7C,CAAC,CAAC;IACN,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;EACd;EAEOgE,iBAAiBA,CAAA,EAAS;IAC7B,KAAK,CAACA,iBAAiB,CAAC,CAAC;IACzB,IAAI,CAACpE,MAAM,CAAC,IAAI,CAACJ,KAAK,CAACV,KAAK,CAACe,gBAAgB,GAAG,CAAC,CAAC;EACtD;EAEAoE,YAAYA,CAACnF,KAAuB,EAAE;IACpC,MAAM+C,cAAc,GAAG/C,KAAK,CAACoF,QAAQ;IACrC,MAAMhB,UAAU,GAAG,IAAI,CAAC1D,KAAK,CAAC6D,iBAAiB,IAAI,CAAC;IACpD,oBACIxF,KAAA,CAAAgD,aAAA,CAAC7C,IAAI;MAAC+C,KAAK,EAAE,IAAI,CAACC,MAAM,CAACgB;IAAK,GAC3B,IAAI,CAACmC,WAAW,EACdtC,cAAc,GACX3D,OAAO,CAAC2D,cAAc,CAAC,IAAIA,cAAc,CAACvB,MAAM,GAC9CuB,cAAc,CAACuC,GAAG,CAAC,CAACjE,IAAS,EAAEC,KAAU,KAAK,IAAI,CAACwB,mBAAmB,CAACzB,IAAI,EAAEC,KAAK,EAAEyB,cAAc,CAAC,CAAC,GACpG,IAAI,CAACD,mBAAmB,CAACC,cAAc,EAAE,CAAC,CAAC,GAC7C,IACF,CAAC;EAEb;AACF"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
3
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
|
-
import React
|
|
4
|
+
import React from 'react';
|
|
5
5
|
import { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';
|
|
6
6
|
import WmAccordionpaneProps from './accordionpane.props';
|
|
7
7
|
import { DEFAULT_CLASS } from './accordionpane.styles';
|
|
8
8
|
import { View } from 'react-native';
|
|
9
9
|
import { isWebPreviewMode } from '@wavemaker/app-rn-runtime/core/utils';
|
|
10
|
-
|
|
10
|
+
import { CollapsiblePane } from '../../panel/collapsible-pane.component';
|
|
11
11
|
export class WmAccordionpaneState extends BaseComponentState {
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments);
|
|
@@ -15,25 +15,6 @@ export class WmAccordionpaneState extends BaseComponentState {
|
|
|
15
15
|
_defineProperty(this, "collapsed", true);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
const AnimatedView = props => {
|
|
19
|
-
const [height, setHeight] = useState(0);
|
|
20
|
-
const offset = Animated.useSharedValue(0);
|
|
21
|
-
offset.value = props.close ? 0 : 1;
|
|
22
|
-
const onLayoutChange = e => {
|
|
23
|
-
var _e$nativeEvent;
|
|
24
|
-
setHeight((((_e$nativeEvent = e.nativeEvent) === null || _e$nativeEvent === void 0 || (_e$nativeEvent = _e$nativeEvent.layout) === null || _e$nativeEvent === void 0 ? void 0 : _e$nativeEvent.height) || height || 100000000) + 1000);
|
|
25
|
-
};
|
|
26
|
-
const animatedStyles = Animated.useAnimatedStyle(() => {
|
|
27
|
-
return {
|
|
28
|
-
maxHeight: Animated.withTiming(offset.value * height)
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
return /*#__PURE__*/React.createElement(Animated.default.View, {
|
|
32
|
-
style: [animatedStyles]
|
|
33
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
34
|
-
onLayout: onLayoutChange
|
|
35
|
-
}, props.children));
|
|
36
|
-
};
|
|
37
18
|
export default class WmAccordionpane extends BaseComponent {
|
|
38
19
|
constructor(props) {
|
|
39
20
|
super(props, DEFAULT_CLASS, new WmAccordionpaneProps(), new WmAccordionpaneState());
|
|
@@ -76,16 +57,17 @@ export default class WmAccordionpane extends BaseComponent {
|
|
|
76
57
|
});
|
|
77
58
|
});
|
|
78
59
|
}
|
|
79
|
-
return props.renderPartial(this.onPartialLoad.bind(this));
|
|
60
|
+
return props.renderPartial(props, this.onPartialLoad.bind(this));
|
|
80
61
|
}
|
|
81
62
|
return props.children;
|
|
82
63
|
}
|
|
83
64
|
renderWidget(props) {
|
|
84
65
|
return isWebPreviewMode() ? /*#__PURE__*/React.createElement(View, {
|
|
85
66
|
style: this.state.collapsed ? {
|
|
86
|
-
maxHeight: 0
|
|
67
|
+
maxHeight: 0,
|
|
68
|
+
overflow: 'hidden'
|
|
87
69
|
} : {}
|
|
88
|
-
}, this._background, this.renderContent(props)) : /*#__PURE__*/React.createElement(
|
|
70
|
+
}, this._background, this.renderContent(props)) : /*#__PURE__*/React.createElement(CollapsiblePane, {
|
|
89
71
|
close: this.state.collapsed
|
|
90
72
|
}, this._background, this.renderContent(props));
|
|
91
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","
|
|
1
|
+
{"version":3,"names":["React","BaseComponent","BaseComponentState","WmAccordionpaneProps","DEFAULT_CLASS","View","isWebPreviewMode","CollapsiblePane","WmAccordionpaneState","constructor","arguments","_defineProperty","WmAccordionpane","props","isCollapsed","state","collapsed","show","updateState","invokeEventCallback","proxy","hide","expand","parent","name","collapse","componentDidMount","accordion","addAccordionPane","onPartialLoad","renderContent","renderPartial","isPartialLoaded","setTimeout","bind","children","renderWidget","createElement","style","maxHeight","overflow","_background","close"],"sources":["accordionpane.component.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useState } from 'react';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\n\nimport WmAccordionpaneProps from './accordionpane.props';\nimport { DEFAULT_CLASS, WmAccordionpaneStyles } from './accordionpane.styles';\nimport WmAccordion from '../accordion.component';\nimport { View } from 'react-native';\nimport { isWebPreviewMode } from '@wavemaker/app-rn-runtime/core/utils';\nimport { CollapsiblePane } from '../../panel/collapsible-pane.component';\n\nexport class WmAccordionpaneState extends BaseComponentState<WmAccordionpaneProps> {\n isPartialLoaded = false;\n collapsed = true;\n}\n\nexport default class WmAccordionpane extends BaseComponent<WmAccordionpaneProps, WmAccordionpaneState, WmAccordionpaneStyles> {\n\n constructor(props: WmAccordionpaneProps) {\n super(props, DEFAULT_CLASS, new WmAccordionpaneProps(), new WmAccordionpaneState());\n }\n\n isCollapsed() {\n return this.state.collapsed;\n }\n \n show() {\n this.updateState({\n collapsed: false\n } as WmAccordionpaneState);\n this.invokeEventCallback('onExpand', [null, this.proxy]);\n }\n\n hide() {\n this.updateState({\n collapsed: true\n } as WmAccordionpaneState);\n this.invokeEventCallback('onCollapse', [null, this.proxy]);\n }\n\n expand() {\n (this.parent as WmAccordion).expand(this.props.name || '');\n }\n\n collapse() {\n (this.parent as WmAccordion).expand(this.props.name || '');\n }\n\n componentDidMount() {\n const accordion = (this.parent) as WmAccordion;\n accordion.addAccordionPane(this);\n super.componentDidMount();\n }\n\n onPartialLoad() {\n this.invokeEventCallback('onLoad', [this]);\n }\n\n renderContent(props: WmAccordionpaneProps) {\n if (props.renderPartial) {\n if (!this.state.isPartialLoaded) {\n setTimeout(() => {\n this.updateState({\n isPartialLoaded: true\n } as WmAccordionpaneState);\n });\n }\n return props.renderPartial(props, this.onPartialLoad.bind(this));\n }\n return props.children;\n }\n renderWidget(props: WmAccordionpaneProps) {\n return isWebPreviewMode() ? \n (<View style={this.state.collapsed ? {maxHeight: 0, overflow: 'hidden'} : {}}>\n {this._background}\n {this.renderContent(props)}\n </View>) :\n (<CollapsiblePane close={this.state.collapsed}>\n {this._background}\n {this.renderContent(props)}\n </CollapsiblePane>);\n }\n}\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAA0C,OAAO;AAC7D,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AAEjG,OAAOC,oBAAoB,MAAM,uBAAuB;AACxD,SAASC,aAAa,QAA+B,wBAAwB;AAE7E,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,gBAAgB,QAAQ,sCAAsC;AACvE,SAASC,eAAe,QAAQ,wCAAwC;AAExE,OAAO,MAAMC,oBAAoB,SAASN,kBAAkB,CAAuB;EAAAO,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA,0BAC/D,KAAK;IAAAA,eAAA,oBACX,IAAI;EAAA;AAClB;AAEA,eAAe,MAAMC,eAAe,SAASX,aAAa,CAAoE;EAE5HQ,WAAWA,CAACI,KAA2B,EAAE;IACvC,KAAK,CAACA,KAAK,EAAET,aAAa,EAAE,IAAID,oBAAoB,CAAC,CAAC,EAAE,IAAIK,oBAAoB,CAAC,CAAC,CAAC;EACrF;EAEAM,WAAWA,CAAA,EAAG;IACZ,OAAO,IAAI,CAACC,KAAK,CAACC,SAAS;EAC7B;EAEAC,IAAIA,CAAA,EAAG;IACL,IAAI,CAACC,WAAW,CAAC;MACfF,SAAS,EAAE;IACb,CAAyB,CAAC;IAC1B,IAAI,CAACG,mBAAmB,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,CAACC,KAAK,CAAC,CAAC;EAC1D;EAEAC,IAAIA,CAAA,EAAG;IACL,IAAI,CAACH,WAAW,CAAC;MACfF,SAAS,EAAE;IACb,CAAyB,CAAC;IAC1B,IAAI,CAACG,mBAAmB,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,CA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ACX,aAAa,CAACjB,KAAK,CACrB,CAAC,gBACNb,KAAA,CAAAqC,aAAA,CAAC9B,eAAe;MAACmC,KAAK,EAAE,IAAI,CAAC3B,KAAK,CAACC;IAAU,GAC3C,IAAI,CAACyB,WAAW,EAChB,IAAI,CAACX,aAAa,CAACjB,KAAK,CACV,CAAE;EACrB;AACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
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); }
|
|
1
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; }
|
|
2
3
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
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); }
|
|
@@ -26,10 +27,10 @@ export default class WmContainer extends PartialHost {
|
|
|
26
27
|
return /*#__PURE__*/React.createElement(Animatedview, {
|
|
27
28
|
entryanimation: props.animation,
|
|
28
29
|
style: this.styles.root
|
|
29
|
-
}, this._background, /*#__PURE__*/React.createElement(Tappable, {
|
|
30
|
+
}, this._background, /*#__PURE__*/React.createElement(Tappable, _extends({}, this.getTestPropsForAction(), {
|
|
30
31
|
target: this,
|
|
31
32
|
styles: dimensions
|
|
32
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
33
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
33
34
|
style: [dimensions, this.styles.content]
|
|
34
35
|
}, this.renderContent(props))));
|
|
35
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","WmContainerProps","DEFAULT_CLASS","Tappable","Animatedview","PartialHost","PartialHostState","WmContainerState","constructor","arguments","_defineProperty","WmContainer","props","renderWidget","dimensions","width","styles","root","undefined","height","createElement","entryanimation","animation","style","_background","target","content","renderContent"],"sources":["container.component.tsx"],"sourcesContent":["import React from 'react';\nimport { View, ViewStyle } from 'react-native';\n\nimport WmContainerProps from './container.props';\nimport { DEFAULT_CLASS, WmContainerStyles } from './container.styles';\nimport { Tappable } from '@wavemaker/app-rn-runtime/core/tappable.component';\nimport { Animatedview } from '@wavemaker/app-rn-runtime/components/basic/animatedview.component';\nimport { PartialHost, PartialHostState } from './partial-host.component';\n\nexport class WmContainerState extends PartialHostState<WmContainerProps> {\n isPartialLoaded = false;\n}\n\nexport default class WmContainer extends PartialHost<WmContainerProps, WmContainerState, WmContainerStyles> {\n constructor(props: WmContainerProps) {\n super(props, DEFAULT_CLASS, new WmContainerProps());\n }\n\n renderWidget(props: WmContainerProps) {\n const dimensions = {\n width: this.styles.root.width ? '100%' : undefined,\n height: this.styles.root.height ? '100%' : undefined\n };\n return (\n <Animatedview entryanimation={props.animation} style={this.styles.root}>\n {this._background}\n <Tappable target={this} styles={dimensions}>\n <View style={[dimensions as ViewStyle, this.styles.content]}>{this.renderContent(props)}</View>\n </Tappable>\n </Animatedview>\n );\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["React","View","WmContainerProps","DEFAULT_CLASS","Tappable","Animatedview","PartialHost","PartialHostState","WmContainerState","constructor","arguments","_defineProperty","WmContainer","props","renderWidget","dimensions","width","styles","root","undefined","height","createElement","entryanimation","animation","style","_background","_extends","getTestPropsForAction","target","content","renderContent"],"sources":["container.component.tsx"],"sourcesContent":["import React from 'react';\nimport { View, ViewStyle } from 'react-native';\n\nimport WmContainerProps from './container.props';\nimport { DEFAULT_CLASS, WmContainerStyles } from './container.styles';\nimport { Tappable } from '@wavemaker/app-rn-runtime/core/tappable.component';\nimport { Animatedview } from '@wavemaker/app-rn-runtime/components/basic/animatedview.component';\nimport { PartialHost, PartialHostState } from './partial-host.component';\n\nexport class WmContainerState extends PartialHostState<WmContainerProps> {\n isPartialLoaded = false;\n}\n\nexport default class WmContainer extends PartialHost<WmContainerProps, WmContainerState, WmContainerStyles> {\n constructor(props: WmContainerProps) {\n super(props, DEFAULT_CLASS, new WmContainerProps());\n }\n\n renderWidget(props: WmContainerProps) {\n const dimensions = {\n width: this.styles.root.width ? '100%' : undefined,\n height: this.styles.root.height ? '100%' : undefined\n };\n return (\n <Animatedview entryanimation={props.animation} style={this.styles.root}>\n {this._background}\n <Tappable {...this.getTestPropsForAction()} target={this} styles={dimensions}>\n <View style={[dimensions as ViewStyle, this.styles.content]}>{this.renderContent(props)}</View>\n </Tappable>\n </Animatedview>\n );\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAmB,cAAc;AAE9C,OAAOC,gBAAgB,MAAM,mBAAmB;AAChD,SAASC,aAAa,QAA2B,oBAAoB;AACrE,SAASC,QAAQ,QAAQ,mDAAmD;AAC5E,SAASC,YAAY,QAAQ,mEAAmE;AAChG,SAASC,WAAW,EAAEC,gBAAgB,QAAQ,0BAA0B;AAExE,OAAO,MAAMC,gBAAgB,SAASD,gBAAgB,CAAmB;EAAAE,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA,0BACrD,KAAK;EAAA;AACzB;AAEA,eAAe,MAAMC,WAAW,SAASN,WAAW,CAAwD;EAC1GG,WAAWA,CAACI,KAAuB,EAAE;IACnC,KAAK,CAACA,KAAK,EAAEV,aAAa,EAAE,IAAID,gBAAgB,CAAC,CAAC,CAAC;EACrD;EAEAY,YAAYA,CAACD,KAAuB,EAAE;IACpC,MAAME,UAAU,GAAG;MACjBC,KAAK,EAAE,IAAI,CAACC,MAAM,CAACC,IAAI,CAACF,KAAK,GAAG,MAAM,GAAGG,SAAS;MAClDC,MAAM,EAAE,IAAI,CAACH,MAAM,CAACC,IAAI,CAACE,MAAM,GAAG,MAAM,GAAGD;IAC7C,CAAC;IACD,oBACEnB,KAAA,CAAAqB,aAAA,CAAChB,YAAY;MAACiB,cAAc,EAAET,KAAK,CAACU,SAAU;MAACC,KAAK,EAAE,IAAI,CAACP,MAAM,CAACC;IAAK,GACpE,IAAI,CAACO,WAAW,eACjBzB,KAAA,CAAAqB,aAAA,CAACjB,QAAQ,EAAAsB,QAAA,KAAK,IAAI,CAACC,qBAAqB,CAAC,CAAC;MAAEC,MAAM,EAAE,IAAK;MAACX,MAAM,EAAEF;IAAW,iBACzEf,KAAA,CAAAqB,aAAA,CAACpB,IAAI;MAACuB,KAAK,EAAE,CAACT,UAAU,EAAgB,IAAI,CAACE,MAAM,CAACY,OAAO;IAAE,GAAE,IAAI,CAACC,aAAa,CAACjB,KAAK,CAAQ,CACzF,CACE,CAAC;EAEnB;AACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { isWebPreviewMode } from '@wavemaker/app-rn-runtime/core/utils';
|
|
4
|
+
const Animated = isWebPreviewMode() ? {} : require('react-native-reanimated');
|
|
5
|
+
export const CollapsiblePane = props => {
|
|
6
|
+
const [height, setHeight] = useState(0);
|
|
7
|
+
const offset = Animated.useSharedValue(0);
|
|
8
|
+
offset.value = props.close ? 0 : 1;
|
|
9
|
+
const onLayoutChange = e => {
|
|
10
|
+
var _e$nativeEvent;
|
|
11
|
+
setHeight((((_e$nativeEvent = e.nativeEvent) === null || _e$nativeEvent === void 0 || (_e$nativeEvent = _e$nativeEvent.layout) === null || _e$nativeEvent === void 0 ? void 0 : _e$nativeEvent.height) || height || 100000000) + 1000);
|
|
12
|
+
};
|
|
13
|
+
const animatedStyles = Animated.useAnimatedStyle(() => {
|
|
14
|
+
return {
|
|
15
|
+
maxHeight: Animated.withTiming(offset.value * height)
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
return /*#__PURE__*/React.createElement(Animated.default.View, {
|
|
19
|
+
style: [{
|
|
20
|
+
overflow: 'hidden'
|
|
21
|
+
}, animatedStyles]
|
|
22
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
23
|
+
onLayout: onLayoutChange
|
|
24
|
+
}, props.children));
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=collapsible-pane.component.js.map
|