@wavemaker/react-runtime 11.14.1-16.6404
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.
- package/actions/base-action.js +32 -0
- package/actions/login-action.js +53 -0
- package/actions/logout-action.js +41 -0
- package/actions/navigation-action.js +145 -0
- package/actions/notification-action.js +147 -0
- package/actions/timer-action.js +164 -0
- package/actions/toast-provider.js +111 -0
- package/actions/toast.js +115 -0
- package/actions/toast.service.js +94 -0
- package/actions/types/index.js +11 -0
- package/components/advanced/carousel/index.js +456 -0
- package/components/advanced/carousel/props.js +5 -0
- package/components/advanced/carousel/template.js +72 -0
- package/components/advanced/login/index.js +307 -0
- package/components/advanced/login/props.js +5 -0
- package/components/advanced/marquee/index.js +158 -0
- package/components/advanced/marquee/props.js +5 -0
- package/components/basic/anchor/index.js +239 -0
- package/components/basic/anchor/props.js +5 -0
- package/components/basic/audio/index.js +61 -0
- package/components/basic/html/index.js +158 -0
- package/components/basic/icon/index.js +85 -0
- package/components/basic/iframe/iframe.utils.js +10 -0
- package/components/basic/iframe/index.js +95 -0
- package/components/basic/label/index.js +139 -0
- package/components/basic/message/index.js +120 -0
- package/components/basic/message/props.js +5 -0
- package/components/basic/picture/index.js +117 -0
- package/components/basic/picture/props.js +5 -0
- package/components/basic/progress-bar/index.js +168 -0
- package/components/basic/progress-bar/props.js +18 -0
- package/components/basic/progress-circle/index.js +196 -0
- package/components/basic/progress-circle/props.js +16 -0
- package/components/basic/richtexteditor/index.js +533 -0
- package/components/basic/richtexteditor/props.js +5 -0
- package/components/basic/search/index.js +1023 -0
- package/components/basic/search/props.js +5 -0
- package/components/basic/search/providers.js +350 -0
- package/components/basic/spinner/index.js +202 -0
- package/components/basic/spinner/props.js +12 -0
- package/components/basic/tile/index.js +91 -0
- package/components/basic/tree/Components/TreeNodeComponent.js +142 -0
- package/components/basic/tree/index.js +503 -0
- package/components/basic/tree/props.js +5 -0
- package/components/basic/tree/utils.js +154 -0
- package/components/basic/video/index.js +85 -0
- package/components/basic/video/props.js +5 -0
- package/components/chart/components/barColumnChart/index.js +132 -0
- package/components/chart/components/barColumnChart/props.js +5 -0
- package/components/chart/components/bubbleChart/index.js +176 -0
- package/components/chart/components/bubbleChart/props.js +5 -0
- package/components/chart/components/chartLegend/components/ClassicLegendItem.js +39 -0
- package/components/chart/components/chartLegend/components/FuriousLegendItem.js +81 -0
- package/components/chart/components/chartLegend/index.js +69 -0
- package/components/chart/components/chartLegend/props.js +5 -0
- package/components/chart/components/chartLegend/utils.js +31 -0
- package/components/chart/components/chartTooltip/index.js +53 -0
- package/components/chart/components/chartTooltip/styles.js +37 -0
- package/components/chart/components/chartTooltip/utils.js +23 -0
- package/components/chart/components/cumulativeLineChart/index.js +113 -0
- package/components/chart/components/cumulativeLineChart/props.js +5 -0
- package/components/chart/components/cumulativeLineChart/utils.js +34 -0
- package/components/chart/components/index.js +40 -0
- package/components/chart/components/lineAreaChart/index.js +140 -0
- package/components/chart/components/lineAreaChart/props.js +5 -0
- package/components/chart/components/noDataMessage/index.js +27 -0
- package/components/chart/components/pieDonutChart/index.js +171 -0
- package/components/chart/components/pieDonutChart/props.js +5 -0
- package/components/chart/constant.js +72 -0
- package/components/chart/index.js +930 -0
- package/components/chart/props.js +5 -0
- package/components/chart/utils.js +691 -0
- package/components/common/AppSpinner.js +36 -0
- package/components/common/app-spinner.js +26 -0
- package/components/common/index.js +12 -0
- package/components/constants.js +1208 -0
- package/components/container/accordion/accordion-pane/index.js +108 -0
- package/components/container/accordion/accordion-pane/props.js +11 -0
- package/components/container/accordion/index.js +232 -0
- package/components/container/accordion/props.js +13 -0
- package/components/container/alignment-utils.js +183 -0
- package/components/container/index.js +188 -0
- package/components/container/layout-grid/grid-column/index.js +34 -0
- package/components/container/layout-grid/grid-row/index.js +24 -0
- package/components/container/layout-grid/index.js +33 -0
- package/components/container/linear-layout/index.js +72 -0
- package/components/container/linear-layout/linear-layout-item/index.js +43 -0
- package/components/container/panel/components/panel-header/index.js +144 -0
- package/components/container/panel/components/panel-header/props.js +5 -0
- package/components/container/panel/hooks.js +144 -0
- package/components/container/panel/index.js +286 -0
- package/components/container/panel/props.js +5 -0
- package/components/container/props.js +5 -0
- package/components/container/tabs/index.js +379 -0
- package/components/container/tabs/props.js +20 -0
- package/components/container/tabs/tab-pane/index.js +42 -0
- package/components/container/tabs/tab-pane/props.js +5 -0
- package/components/container/wizard/WizardContext.js +16 -0
- package/components/container/wizard/components/StepComponents.js +100 -0
- package/components/container/wizard/components/WizardStep.js +89 -0
- package/components/container/wizard/index.js +710 -0
- package/components/container/wizard/props.js +5 -0
- package/components/container/wizard/utils.js +133 -0
- package/components/container/wizard/wizard-action/index.js +22 -0
- package/components/container/wizard/wizard-step/index.js +94 -0
- package/components/data/card/card-actions/index.js +24 -0
- package/components/data/card/card-content/index.js +38 -0
- package/components/data/card/card-footer/index.js +24 -0
- package/components/data/card/index.js +246 -0
- package/components/data/card/props.js +5 -0
- package/components/data/form/base-form/constant.js +39 -0
- package/components/data/form/base-form/index.js +460 -0
- package/components/data/form/base-form/props.js +29 -0
- package/components/data/form/base-form/utils.js +42 -0
- package/components/data/form/dynamic-fields/index.js +196 -0
- package/components/data/form/dynamic-fields/props.js +5 -0
- package/components/data/form/dynamic-fields/utils.js +237 -0
- package/components/data/form/form-action/index.js +71 -0
- package/components/data/form/form-body/index.js +26 -0
- package/components/data/form/form-context.js +34 -0
- package/components/data/form/form-controller/props.js +19 -0
- package/components/data/form/form-controller/validation-contrustor.js +313 -0
- package/components/data/form/form-controller/withFormController.js +320 -0
- package/components/data/form/form-field/base-field.js +138 -0
- package/components/data/form/form-field/index.js +36 -0
- package/components/data/form/form-field/props.js +5 -0
- package/components/data/form/form-footer/index.js +26 -0
- package/components/data/form/form-header/index.js +56 -0
- package/components/data/form/index.js +39 -0
- package/components/data/form/props.js +5 -0
- package/components/data/list/components/GroupHeader.js +35 -0
- package/components/data/list/components/GroupedListItems.js +98 -0
- package/components/data/list/components/ListContainer.js +27 -0
- package/components/data/list/components/ListDND.js +241 -0
- package/components/data/list/components/ListHeader.js +59 -0
- package/components/data/list/components/ListItem.js +148 -0
- package/components/data/list/components/ListItemWithTemplate.js +59 -0
- package/components/data/list/components/ListItems.js +231 -0
- package/components/data/list/components/ListPagination.js +165 -0
- package/components/data/list/components/LoadMoreButton.js +39 -0
- package/components/data/list/components/NoDataMessage.js +22 -0
- package/components/data/list/components/StandardListItems.js +84 -0
- package/components/data/list/components/index.js +119 -0
- package/components/data/list/components/props.js +5 -0
- package/components/data/list/hooks/index.js +75 -0
- package/components/data/list/hooks/props.js +5 -0
- package/components/data/list/hooks/useCurrentPageItems.js +48 -0
- package/components/data/list/hooks/useGroupedData.js +37 -0
- package/components/data/list/hooks/useListData.js +60 -0
- package/components/data/list/hooks/useListEffects.js +285 -0
- package/components/data/list/hooks/useListEventHandlers.js +291 -0
- package/components/data/list/hooks/useListPagination.js +168 -0
- package/components/data/list/hooks/useListState.js +98 -0
- package/components/data/list/hooks/useListStateManager.js +195 -0
- package/components/data/list/hooks/usePaginatedGroupedData.js +121 -0
- package/components/data/list/index.js +611 -0
- package/components/data/list/props.js +5 -0
- package/components/data/list/templates/media-template.js +53 -0
- package/components/data/list/utils/constants.js +81 -0
- package/components/data/list/utils/list-helpers.js +173 -0
- package/components/data/list/utils/list-widget-methods.js +114 -0
- package/components/data/live-filter/index.js +279 -0
- package/components/data/live-filter/props.js +12 -0
- package/components/data/live-form/index.js +93 -0
- package/components/data/live-form/props.js +16 -0
- package/components/data/pagination/components/BasicPagination.js +77 -0
- package/components/data/pagination/components/ClassicPagination.js +191 -0
- package/components/data/pagination/components/InlinePagination.js +99 -0
- package/components/data/pagination/components/LoadingComponent.js +31 -0
- package/components/data/pagination/components/PageSizeSelector.js +175 -0
- package/components/data/pagination/components/PagerNavigation.js +105 -0
- package/components/data/pagination/components/TotalRecords.js +52 -0
- package/components/data/pagination/components/index.js +47 -0
- package/components/data/pagination/components/props.js +5 -0
- package/components/data/pagination/hooks/index.js +19 -0
- package/components/data/pagination/hooks/props.js +5 -0
- package/components/data/pagination/hooks/useNavigationSize.js +44 -0
- package/components/data/pagination/hooks/usePagination.js +796 -0
- package/components/data/pagination/index.js +322 -0
- package/components/data/table/components/AddNewRow.js +190 -0
- package/components/data/table/components/EditableCell.js +91 -0
- package/components/data/table/components/FieldValidationError.js +24 -0
- package/components/data/table/components/RowExpansionButton.js +74 -0
- package/components/data/table/components/TableBody.js +279 -0
- package/components/data/table/components/TableFilters.js +325 -0
- package/components/data/table/components/TableFooterActions.js +48 -0
- package/components/data/table/components/TableHeader.js +174 -0
- package/components/data/table/components/TablePanelHeading.js +68 -0
- package/components/data/table/components/index.js +74 -0
- package/components/data/table/hooks/index.js +219 -0
- package/components/data/table/hooks/useCellState.js +117 -0
- package/components/data/table/hooks/useDynamicColumns.js +85 -0
- package/components/data/table/hooks/useEditingState.js +47 -0
- package/components/data/table/hooks/useFormWidget.js +184 -0
- package/components/data/table/hooks/usePaginationState.js +60 -0
- package/components/data/table/hooks/usePanelStructure.js +40 -0
- package/components/data/table/hooks/useResponsiveColumns.js +34 -0
- package/components/data/table/hooks/useRowExpansion.js +110 -0
- package/components/data/table/hooks/useRowHandlers.js +38 -0
- package/components/data/table/hooks/useRowSelection.js +213 -0
- package/components/data/table/hooks/useServerSideSorting.js +165 -0
- package/components/data/table/hooks/useTableColumns.js +263 -0
- package/components/data/table/hooks/useTableData.js +154 -0
- package/components/data/table/hooks/useTableEdit.js +467 -0
- package/components/data/table/hooks/useTableEffects.js +139 -0
- package/components/data/table/hooks/useTableFilter.js +389 -0
- package/components/data/table/hooks/useTableInitialization.js +103 -0
- package/components/data/table/hooks/useTableState.js +69 -0
- package/components/data/table/hooks/useTableStateManager.js +558 -0
- package/components/data/table/index.js +1295 -0
- package/components/data/table/live-table/index.js +232 -0
- package/components/data/table/props.js +5 -0
- package/components/data/table/table-action/index.js +78 -0
- package/components/data/table/table-column/index.js +35 -0
- package/components/data/table/table-row/index.js +49 -0
- package/components/data/table/table-row-action/index.js +74 -0
- package/components/data/table/utils/buildSelectionColumns.js +173 -0
- package/components/data/table/utils/columnBuilder.js +209 -0
- package/components/data/table/utils/columnProxy.js +48 -0
- package/components/data/table/utils/columnWidthDistribution.js +98 -0
- package/components/data/table/utils/constants.js +80 -0
- package/components/data/table/utils/crud-handlers.js +518 -0
- package/components/data/table/utils/dynamic-columns.js +118 -0
- package/components/data/table/utils/index.js +607 -0
- package/components/data/table/utils/renderDisplayCell.js +183 -0
- package/components/data/table/utils/selectionUtils.js +166 -0
- package/components/data/table/utils/table-helpers.js +100 -0
- package/components/data/table/utils/validation.js +124 -0
- package/components/data/types.js +113 -0
- package/components/data/utils/field-data-utils.js +66 -0
- package/components/data/utils/filter-field-util.js +81 -0
- package/components/data/utils/index.js +216 -0
- package/components/dialogs/alert-dialog/index.js +80 -0
- package/components/dialogs/confirm-dialog/index.js +105 -0
- package/components/dialogs/dialog/index.js +56 -0
- package/components/dialogs/dialog-actions/index.js +18 -0
- package/components/dialogs/dialog-body/index.js +21 -0
- package/components/dialogs/dialog-content/index.js +30 -0
- package/components/dialogs/dialog-header/index.js +93 -0
- package/components/dialogs/iframe-dialog/index.js +114 -0
- package/components/dialogs/index.js +129 -0
- package/components/dialogs/login-dialog/index.js +369 -0
- package/components/dialogs/login-dialog/props.js +5 -0
- package/components/dialogs/page-dialog/index.js +96 -0
- package/components/dialogs/withDialogWrapper.js +108 -0
- package/components/form/button/index.js +216 -0
- package/components/form/button-group/index.js +60 -0
- package/components/input/calendar/index.js +546 -0
- package/components/input/calendar/props.js +5 -0
- package/components/input/calendar/utils.js +340 -0
- package/components/input/chips/SortableChip/index.js +115 -0
- package/components/input/chips/SortableChip/props.js +5 -0
- package/components/input/chips/index.js +488 -0
- package/components/input/chips/props.js +5 -0
- package/components/input/chips/utils.js +259 -0
- package/components/input/color-picker/index.js +678 -0
- package/components/input/color-picker/props.js +5 -0
- package/components/input/composite/index.js +137 -0
- package/components/input/currency/index.js +263 -0
- package/components/input/currency/props.js +5 -0
- package/components/input/default/checkbox/index.js +230 -0
- package/components/input/default/checkbox/props.js +5 -0
- package/components/input/default/checkboxset/index.js +476 -0
- package/components/input/default/checkboxset/props.js +5 -0
- package/components/input/default/radioset/index.js +379 -0
- package/components/input/default/radioset/props.js +5 -0
- package/components/input/default/switch/index.js +490 -0
- package/components/input/default/switch/prop.js +5 -0
- package/components/input/epoch/date/components/DatePickerPopover.js +220 -0
- package/components/input/epoch/date/index.js +520 -0
- package/components/input/epoch/date/props.js +5 -0
- package/components/input/epoch/date/styled.js +70 -0
- package/components/input/epoch/date/utils.js +108 -0
- package/components/input/epoch/datetime/index.js +656 -0
- package/components/input/epoch/datetime/props.js +5 -0
- package/components/input/epoch/datetime/styled.js +90 -0
- package/components/input/epoch/datetime/utils.js +244 -0
- package/components/input/epoch/time/index.js +412 -0
- package/components/input/epoch/time/props.js +5 -0
- package/components/input/epoch/time/utils.js +209 -0
- package/components/input/fileupload/Utils.js +134 -0
- package/components/input/fileupload/components/ListItems.js +140 -0
- package/components/input/fileupload/components/MultiUpload.js +85 -0
- package/components/input/fileupload/components/SingleUpload.js +65 -0
- package/components/input/fileupload/index.js +170 -0
- package/components/input/fileupload/props.js +5 -0
- package/components/input/fileupload/useFileUpload.js +400 -0
- package/components/input/number/index.js +295 -0
- package/components/input/number/props.js +5 -0
- package/components/input/rating/index.js +368 -0
- package/components/input/rating/props.js +5 -0
- package/components/input/select/index.js +344 -0
- package/components/input/select/props.js +5 -0
- package/components/input/slider/index.js +167 -0
- package/components/input/slider/props.js +5 -0
- package/components/input/text/index.js +434 -0
- package/components/input/text/props.js +5 -0
- package/components/input/text/util.js +179 -0
- package/components/input/textarea/index.js +347 -0
- package/components/input/textarea/props.js +5 -0
- package/components/layout/footer/index.js +30 -0
- package/components/layout/header/index.js +30 -0
- package/components/layout/leftnav/index.js +44 -0
- package/components/layout/rightnav/index.js +32 -0
- package/components/layout/topnav/index.js +34 -0
- package/components/navbar/index.js +41 -0
- package/components/navbar/nav/index.js +102 -0
- package/components/navbar/nav/props.js +5 -0
- package/components/navbar/nav-item/index.js +44 -0
- package/components/navigation/breadcrumb/index.js +56 -0
- package/components/navigation/breadcrumb/props.js +5 -0
- package/components/navigation/menu/components/ListItems.js +66 -0
- package/components/navigation/menu/constants.js +101 -0
- package/components/navigation/menu/index.js +807 -0
- package/components/navigation/menu/props.js +5 -0
- package/components/navigation/popover/index.js +209 -0
- package/components/navigation/popover/props.js +15 -0
- package/components/page/content/index.js +28 -0
- package/components/page/error-boundary/index.js +108 -0
- package/components/page/index.js +137 -0
- package/components/page/page-content/index.js +23 -0
- package/components/page/partial/index.js +36 -0
- package/components/page/partial-container/index.js +48 -0
- package/components/page/props.js +5 -0
- package/components/page/toast-container/index.js +33 -0
- package/components/prefab/container/index.js +46 -0
- package/components/prefab/index.js +67 -0
- package/context/AppContext.js +25 -0
- package/context/AppSpinnerProvider.js +43 -0
- package/context/LocalizationProvider.js +79 -0
- package/context/PrefabContext.js +66 -0
- package/context/WidgetProvider.js +187 -0
- package/core/app-config.js +1 -0
- package/core/app.service.js +357 -0
- package/core/appVariablesStore.js +20 -0
- package/core/appstore.js +88 -0
- package/core/constants/currency-constant.js +1071 -0
- package/core/constants/events.js +34 -0
- package/core/constants/index.js +27 -0
- package/core/dialog.service.js +76 -0
- package/core/event-notifier.js +151 -0
- package/core/formatter/date-formatters.js +222 -0
- package/core/formatter/index.js +131 -0
- package/core/formatter/number-formatters.js +142 -0
- package/core/formatter/security-formatters.js +323 -0
- package/core/formatter/string-formatters.js +52 -0
- package/core/formatter/types.js +18 -0
- package/core/formatters.js +24 -0
- package/core/proxy-service.js +412 -0
- package/core/script-registry.js +63 -0
- package/core/security.service.js +11 -0
- package/core/util/common.js +33 -0
- package/core/util/dom.js +107 -0
- package/core/util/index.js +136 -0
- package/core/util/security.js +184 -0
- package/core/util/utils.js +189 -0
- package/core/widget-observer.js +98 -0
- package/higherOrder/BaseApp.js +430 -0
- package/higherOrder/BaseAppProps.js +5 -0
- package/higherOrder/BaseDateTime.js +251 -0
- package/higherOrder/BasePage.js +715 -0
- package/higherOrder/BasePartial.js +124 -0
- package/higherOrder/BasePrefab.js +145 -0
- package/higherOrder/DataNav.js +377 -0
- package/higherOrder/helper.js +43 -0
- package/higherOrder/props.js +5 -0
- package/higherOrder/withBaseWrapper.js +183 -0
- package/hooks/useAccess.js +308 -0
- package/hooks/useAppConfig.js +42 -0
- package/hooks/useAuth.js +562 -0
- package/hooks/useDataSourceSubscription.js +125 -0
- package/hooks/useDebounce.js +76 -0
- package/hooks/useDeviceVisibility.js +49 -0
- package/hooks/useHttp.js +338 -0
- package/libs/index.js +20 -0
- package/mui-config/theme-provider.js +17 -0
- package/mui-config/theme.js +371 -0
- package/package-lock.json +10177 -0
- package/package.json +95 -0
- package/store/index.js +33 -0
- package/store/middleware/navigationMiddleware.js +48 -0
- package/store/slices/appConfigSlice.js +103 -0
- package/store/slices/authSlice.js +508 -0
- package/store/slices/i18nSlice.js +206 -0
- package/types/index.js +15 -0
- package/utils/dataset-util.js +174 -0
- package/utils/eval-expression.js +32 -0
- package/utils/form-state.util.js +140 -0
- package/utils/form-utils.js +187 -0
- package/utils/format-util.js +260 -0
- package/utils/page-params-util.js +24 -0
- package/utils/resource-url.js +27 -0
- package/utils/state-persistance.js +343 -0
- package/utils/style-utils.js +73 -0
- package/utils/transformedDataset-utils.js +633 -0
- package/utils/widget-cleanup-util.js +84 -0
- package/utils/widgets.js +99 -0
- package/variables/base-variable.js +173 -0
- package/variables/constants.js +27 -0
- package/variables/live-variable.js +166 -0
- package/variables/model-variable.js +77 -0
- package/variables/service-variable.js +307 -0
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
16
|
+
var _reactHookForm = require("react-hook-form");
|
|
17
|
+
var _get = _interopRequireDefault(require("lodash-es/get"));
|
|
18
|
+
var _set = _interopRequireDefault(require("lodash-es/set"));
|
|
19
|
+
var _props = require("./props");
|
|
20
|
+
var _utils = require("./utils");
|
|
21
|
+
var _formContext = require("../form-context");
|
|
22
|
+
var _utils2 = require("../../utils");
|
|
23
|
+
var _lodashEs = require("lodash-es");
|
|
24
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
25
|
+
var __jsx = _react["default"].createElement;
|
|
26
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
27
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
28
|
+
var DEFAULT_CLASS = "panel app-panel app-form";
|
|
29
|
+
var BaseForm = function BaseForm(WrappedComponent) {
|
|
30
|
+
var ControlledForm = function ControlledForm(FormProps) {
|
|
31
|
+
// setting up default props for form
|
|
32
|
+
var props = _objectSpread(_objectSpread({}, _props.defaultProps), FormProps);
|
|
33
|
+
var isInsideWizard = props.isInsideWizard || false;
|
|
34
|
+
var primaryKeyRef = (0, _react.useRef)([]);
|
|
35
|
+
var formRef = (0, _react.useRef)(null);
|
|
36
|
+
var _useState = (0, _react.useState)({}),
|
|
37
|
+
formfields = _useState[0],
|
|
38
|
+
setFormfields = _useState[1];
|
|
39
|
+
var _useState2 = (0, _react.useState)({}),
|
|
40
|
+
headerActions = _useState2[0],
|
|
41
|
+
setHeaderActions = _useState2[1];
|
|
42
|
+
var _useState3 = (0, _react.useState)({}),
|
|
43
|
+
initialValues = _useState3[0];
|
|
44
|
+
var _useState4 = (0, _react.useState)(props.expanded),
|
|
45
|
+
expanded = _useState4[0],
|
|
46
|
+
setExpanded = _useState4[1];
|
|
47
|
+
var _useState5 = (0, _react.useState)(false),
|
|
48
|
+
showmessage = _useState5[0],
|
|
49
|
+
setShowMessage = _useState5[1];
|
|
50
|
+
var _useState6 = (0, _react.useState)({
|
|
51
|
+
caption: "",
|
|
52
|
+
type: ""
|
|
53
|
+
}),
|
|
54
|
+
statusMessage = _useState6[0],
|
|
55
|
+
setStatusMessage = _useState6[1];
|
|
56
|
+
var messageRef = (0, _react.useRef)(null);
|
|
57
|
+
var _useState7 = (0, _react.useState)(false),
|
|
58
|
+
showViewMode = _useState7[0],
|
|
59
|
+
setShowViewMode = _useState7[1];
|
|
60
|
+
var _useForm = (0, _reactHookForm.useForm)({
|
|
61
|
+
defaultValues: props.formData,
|
|
62
|
+
mode: "onTouched",
|
|
63
|
+
reValidateMode: "onBlur"
|
|
64
|
+
}),
|
|
65
|
+
control = _useForm.control,
|
|
66
|
+
handleSubmit = _useForm.handleSubmit,
|
|
67
|
+
_useForm$formState = _useForm.formState,
|
|
68
|
+
errors = _useForm$formState.errors,
|
|
69
|
+
isValid = _useForm$formState.isValid,
|
|
70
|
+
reset = _useForm.reset,
|
|
71
|
+
watch = _useForm.watch,
|
|
72
|
+
trigger = _useForm.trigger,
|
|
73
|
+
clearErrors = _useForm.clearErrors;
|
|
74
|
+
|
|
75
|
+
// update the form data when the formdata prop changes
|
|
76
|
+
(0, _react.useEffect)(function () {
|
|
77
|
+
if (props.formdata && (0, _typeof2["default"])(props.formdata) === "object" && !Array.isArray(props.formdata) && Object.keys(props.formdata).length > 0) {
|
|
78
|
+
reset(props.formdata);
|
|
79
|
+
if (props["form-type"] === "live-filter") {
|
|
80
|
+
debouncedFilter();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}, [props.formdata, reset]);
|
|
84
|
+
function debouncedFilter() {
|
|
85
|
+
var debouncedFilter = (0, _lodashEs.debounce)(filter, 250);
|
|
86
|
+
debouncedFilter();
|
|
87
|
+
}
|
|
88
|
+
var formreset = function formreset() {
|
|
89
|
+
Object.keys(formfields).forEach(function (key) {
|
|
90
|
+
formfields[key].datavalue = formfields[key].defaultvalue;
|
|
91
|
+
formfields[key].value = formfields[key].defaultvalue;
|
|
92
|
+
});
|
|
93
|
+
setTimeout(function () {
|
|
94
|
+
setFormfields(function (prev) {
|
|
95
|
+
Object.keys(prev).forEach(function (key) {
|
|
96
|
+
prev[key].datavalue = prev[key].defaultvalue;
|
|
97
|
+
prev[key].value = prev[key].defaultvalue;
|
|
98
|
+
});
|
|
99
|
+
return prev;
|
|
100
|
+
});
|
|
101
|
+
}, 100);
|
|
102
|
+
reset(initialValues);
|
|
103
|
+
};
|
|
104
|
+
var isElementInViewport = function isElementInViewport(el) {
|
|
105
|
+
if (!el) return false;
|
|
106
|
+
var rect = el.getBoundingClientRect();
|
|
107
|
+
return rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);
|
|
108
|
+
};
|
|
109
|
+
var scrollToElement = function scrollToElement(el) {
|
|
110
|
+
if (el) {
|
|
111
|
+
el.scrollIntoView({
|
|
112
|
+
behavior: "smooth",
|
|
113
|
+
block: "start"
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
var checkAppServiceErrorMsg = function checkAppServiceErrorMsg(type) {
|
|
118
|
+
var notificationAction = (0, _get["default"])(props.listener, "Actions.appNotification");
|
|
119
|
+
if (notificationAction && type === "error") {
|
|
120
|
+
var _notificationAction$g;
|
|
121
|
+
return notificationAction === null || notificationAction === void 0 || (_notificationAction$g = notificationAction.getMessage) === null || _notificationAction$g === void 0 ? void 0 : _notificationAction$g.call(notificationAction);
|
|
122
|
+
}
|
|
123
|
+
return;
|
|
124
|
+
};
|
|
125
|
+
var clearMessage = function clearMessage() {
|
|
126
|
+
toggleMessage(false);
|
|
127
|
+
};
|
|
128
|
+
var toggleMessage = function toggleMessage(state, msg, type, header) {
|
|
129
|
+
var template = msg;
|
|
130
|
+
if (state && msg) {
|
|
131
|
+
if (type === "error" && props.errormessage && props.errormessage.length > 0) {
|
|
132
|
+
template = props.errormessage;
|
|
133
|
+
}
|
|
134
|
+
if (props.messagelayout === "Inline") {
|
|
135
|
+
template = checkAppServiceErrorMsg(type) || template;
|
|
136
|
+
setStatusMessage({
|
|
137
|
+
caption: template || "",
|
|
138
|
+
type: type
|
|
139
|
+
});
|
|
140
|
+
setShowMessage(true);
|
|
141
|
+
if (messageRef.current && messageRef.current.showMessage) {
|
|
142
|
+
messageRef.current.showMessage(template, type);
|
|
143
|
+
}
|
|
144
|
+
// Scroll to top if not in viewport
|
|
145
|
+
var formEl = formRef.current;
|
|
146
|
+
if (formEl && !isElementInViewport(formEl)) {
|
|
147
|
+
scrollToElement(formEl);
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
var _props$listener;
|
|
151
|
+
props === null || props === void 0 || (_props$listener = props.listener) === null || _props$listener === void 0 || (_props$listener = _props$listener.App) === null || _props$listener === void 0 || _props$listener.notifyApp(template, type);
|
|
152
|
+
}
|
|
153
|
+
} else {
|
|
154
|
+
setStatusMessage({
|
|
155
|
+
caption: ""
|
|
156
|
+
});
|
|
157
|
+
setShowMessage(false);
|
|
158
|
+
}
|
|
159
|
+
if (formRef.current) {
|
|
160
|
+
scrollToElement(formRef.current);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
var validateFieldsOnSubmit = (0, _react.useCallback)(function () {
|
|
164
|
+
return trigger();
|
|
165
|
+
}, [trigger]);
|
|
166
|
+
var handleFormSubmit = /*#__PURE__*/function () {
|
|
167
|
+
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(data, e, operation) {
|
|
168
|
+
var isValid, _props$listener2, result, FormData, _props$listener3, operationType;
|
|
169
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
170
|
+
while (1) switch (_context.prev = _context.next) {
|
|
171
|
+
case 0:
|
|
172
|
+
if (!e) {
|
|
173
|
+
e = new Event("submit");
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// check form is valid or not
|
|
177
|
+
_context.next = 3;
|
|
178
|
+
return validateFieldsOnSubmit();
|
|
179
|
+
case 3:
|
|
180
|
+
isValid = _context.sent;
|
|
181
|
+
if (isValid) {
|
|
182
|
+
_context.next = 7;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
props === null || props === void 0 || (_props$listener2 = props.listener) === null || _props$listener2 === void 0 || _props$listener2.onChange(props.name, {
|
|
186
|
+
valid: false,
|
|
187
|
+
errors: errors
|
|
188
|
+
});
|
|
189
|
+
return _context.abrupt("return");
|
|
190
|
+
case 7:
|
|
191
|
+
if (!props.onBeforeSubmit) {
|
|
192
|
+
_context.next = 13;
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
_context.next = 10;
|
|
196
|
+
return props.onBeforeSubmit(e, props, data);
|
|
197
|
+
case 10:
|
|
198
|
+
result = _context.sent;
|
|
199
|
+
if (!(result === false)) {
|
|
200
|
+
_context.next = 13;
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
return _context.abrupt("return");
|
|
204
|
+
case 13:
|
|
205
|
+
FormData = {};
|
|
206
|
+
Object.keys(data).forEach(function (key) {
|
|
207
|
+
(0, _set["default"])(FormData, key, data[key]);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
// form submit
|
|
211
|
+
if (props.formSubmit) {
|
|
212
|
+
if ((_props$listener3 = props.listener) !== null && _props$listener3 !== void 0 && _props$listener3.onChange) {
|
|
213
|
+
props.listener.onChange(props.name, {
|
|
214
|
+
dataoutput: data
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// get the operation type
|
|
219
|
+
operationType = props.widgettype === "live-form" && !operation ? (0, _utils2.findOperationType)(FormData, primaryKeyRef.current) : operation;
|
|
220
|
+
props.formSubmit(FormData, function (data) {
|
|
221
|
+
if (props.widgettype === "live-form" && operationType === "insert") {
|
|
222
|
+
reset(data);
|
|
223
|
+
}
|
|
224
|
+
onResultCb((0, _get["default"])(data, "params"), "success");
|
|
225
|
+
toggleMessage(true, props.postmessage, "success");
|
|
226
|
+
}, function (error) {
|
|
227
|
+
toggleMessage(true, props.errormessage || error || error.message, "error");
|
|
228
|
+
onResultCb(error, "");
|
|
229
|
+
}, operationType);
|
|
230
|
+
}
|
|
231
|
+
if (props !== null && props !== void 0 && props.onSubmit) {
|
|
232
|
+
props.onSubmit(e, props, FormData);
|
|
233
|
+
}
|
|
234
|
+
case 17:
|
|
235
|
+
case "end":
|
|
236
|
+
return _context.stop();
|
|
237
|
+
}
|
|
238
|
+
}, _callee);
|
|
239
|
+
}));
|
|
240
|
+
return function handleFormSubmit(_x, _x2, _x3) {
|
|
241
|
+
return _ref.apply(this, arguments);
|
|
242
|
+
};
|
|
243
|
+
}();
|
|
244
|
+
var formfieldsRef = (0, _react.useRef)(formfields);
|
|
245
|
+
var submit = handleSubmit(function (data, e) {
|
|
246
|
+
return handleFormSubmit(data, e);
|
|
247
|
+
});
|
|
248
|
+
var deleteEntry = handleSubmit(function (data, e) {
|
|
249
|
+
return handleFormSubmit(data, e, "delete");
|
|
250
|
+
});
|
|
251
|
+
var livefilterFn = props.Livefilter || function () {};
|
|
252
|
+
var filter = handleSubmit(function (data, e) {
|
|
253
|
+
return livefilterFn(data, false, formfieldsRef.current);
|
|
254
|
+
});
|
|
255
|
+
var clearFilter = handleSubmit(function (data, e) {
|
|
256
|
+
formreset();
|
|
257
|
+
livefilterFn(data, true, formfieldsRef.current);
|
|
258
|
+
});
|
|
259
|
+
var onResultCb = /*#__PURE__*/function () {
|
|
260
|
+
var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(data, status, event) {
|
|
261
|
+
var params;
|
|
262
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
263
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
264
|
+
case 0:
|
|
265
|
+
params = {
|
|
266
|
+
$event: event,
|
|
267
|
+
$data: data,
|
|
268
|
+
$operation: props.operationType
|
|
269
|
+
};
|
|
270
|
+
if (props.onResult) {
|
|
271
|
+
props.onResult(event, props, data);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// whether service call success or failure call this method
|
|
275
|
+
if (status) {
|
|
276
|
+
// if service call is success call this method
|
|
277
|
+
props.onSuccess(event, props, data);
|
|
278
|
+
if (props.messagelayout === "Inline") {
|
|
279
|
+
toggleMessage(true, props.successmessage, "success");
|
|
280
|
+
}
|
|
281
|
+
} else {
|
|
282
|
+
// if service call fails call this method
|
|
283
|
+
props.onError(event, props, data);
|
|
284
|
+
if (props.messagelayout === "Inline") {
|
|
285
|
+
toggleMessage(true, props.errormessage, "error");
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
case 3:
|
|
289
|
+
case "end":
|
|
290
|
+
return _context2.stop();
|
|
291
|
+
}
|
|
292
|
+
}, _callee2);
|
|
293
|
+
}));
|
|
294
|
+
return function onResultCb(_x4, _x5, _x6) {
|
|
295
|
+
return _ref2.apply(this, arguments);
|
|
296
|
+
};
|
|
297
|
+
}();
|
|
298
|
+
|
|
299
|
+
// register header action
|
|
300
|
+
var registerHeaderAction = function registerHeaderAction(actionName, action) {
|
|
301
|
+
if (!action || !actionName) {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
if (!headerActions[actionName]) {
|
|
305
|
+
setHeaderActions(function (prev) {
|
|
306
|
+
return _objectSpread(_objectSpread({}, prev), {}, (0, _defineProperty2["default"])({}, actionName, action));
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
// form onChange
|
|
312
|
+
var onChangeHandler = function onChangeHandler(fieldName, value) {
|
|
313
|
+
if (!fieldName || !value) {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
setFormfields(function (prev) {
|
|
317
|
+
return _objectSpread(_objectSpread({}, prev), {}, (0, _defineProperty2["default"])({}, fieldName, _objectSpread(_objectSpread({}, prev[fieldName]), {}, {
|
|
318
|
+
value: value,
|
|
319
|
+
datavalue: value
|
|
320
|
+
})));
|
|
321
|
+
});
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
// get the classes according to the captionwidth and captionposition
|
|
325
|
+
var _useMemo = (0, _react.useMemo)(function () {
|
|
326
|
+
return (0, _utils.getFieldLayoutConfig)(props.captionwidth, props.captionposition, "os");
|
|
327
|
+
}, [props.captionwidth, props.captionposition]),
|
|
328
|
+
captionCls = _useMemo.captionCls,
|
|
329
|
+
widgetCls = _useMemo.widgetCls;
|
|
330
|
+
function expandCollapsePanel() {
|
|
331
|
+
if (props.collapsible) {
|
|
332
|
+
// flip the active flag
|
|
333
|
+
setExpanded(!expanded);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
var getFieldValue = function getFieldValue(fieldName) {
|
|
337
|
+
return watch(fieldName);
|
|
338
|
+
};
|
|
339
|
+
var ref = {
|
|
340
|
+
control: control,
|
|
341
|
+
watch: watch,
|
|
342
|
+
registerHeaderAction: registerHeaderAction,
|
|
343
|
+
onChangeHandler: onChangeHandler,
|
|
344
|
+
trigger: trigger,
|
|
345
|
+
errors: errors,
|
|
346
|
+
name: props.name,
|
|
347
|
+
captionposition: props.captionposition,
|
|
348
|
+
captionCls: captionCls,
|
|
349
|
+
widgetCls: widgetCls,
|
|
350
|
+
validationtype: props.validationtype,
|
|
351
|
+
showViewMode: showViewMode,
|
|
352
|
+
formdata: props.formdata,
|
|
353
|
+
getFieldValue: getFieldValue
|
|
354
|
+
};
|
|
355
|
+
var formProps = _objectSpread(_objectSpread({}, props), {}, {
|
|
356
|
+
submit: submit,
|
|
357
|
+
formreset: formreset,
|
|
358
|
+
formfields: formfields,
|
|
359
|
+
formWidgets: formfields,
|
|
360
|
+
headerActions: headerActions,
|
|
361
|
+
ref: ref,
|
|
362
|
+
toggleMessage: toggleMessage,
|
|
363
|
+
clearMessage: clearMessage,
|
|
364
|
+
expandCollapsePanel: expandCollapsePanel,
|
|
365
|
+
expanded: expanded,
|
|
366
|
+
showmessage: showmessage,
|
|
367
|
+
statusMessage: statusMessage,
|
|
368
|
+
showViewMode: showViewMode,
|
|
369
|
+
filter: filter,
|
|
370
|
+
clearFilter: clearFilter,
|
|
371
|
+
validateFieldsOnSubmit: validateFieldsOnSubmit,
|
|
372
|
+
valid: isValid,
|
|
373
|
+
errors: errors,
|
|
374
|
+
"delete": deleteEntry,
|
|
375
|
+
cancel: cancel,
|
|
376
|
+
"new": create,
|
|
377
|
+
edit: edit,
|
|
378
|
+
setShowViewMode: setShowViewMode
|
|
379
|
+
});
|
|
380
|
+
var conditionalProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, props.target && {
|
|
381
|
+
target: props.target
|
|
382
|
+
}), props.method && {
|
|
383
|
+
method: props.method
|
|
384
|
+
}), props.encType && {
|
|
385
|
+
encType: props.encType
|
|
386
|
+
}), props.action && {
|
|
387
|
+
action: props.action
|
|
388
|
+
});
|
|
389
|
+
(0, _react.useEffect)(function () {
|
|
390
|
+
if (formRef.current) {
|
|
391
|
+
formRef.current.getFormData = function () {
|
|
392
|
+
return {
|
|
393
|
+
values: watch(),
|
|
394
|
+
isValid: isValid
|
|
395
|
+
};
|
|
396
|
+
};
|
|
397
|
+
formRef.current.validateForm = function () {
|
|
398
|
+
return trigger();
|
|
399
|
+
};
|
|
400
|
+
formRef.current.clearErrors = function () {
|
|
401
|
+
clearErrors();
|
|
402
|
+
};
|
|
403
|
+
formRef.current.getProps = function () {
|
|
404
|
+
return props;
|
|
405
|
+
};
|
|
406
|
+
formRef.current.formWidgets = formfields;
|
|
407
|
+
}
|
|
408
|
+
}, [watch, trigger, isValid, errors, formfields]);
|
|
409
|
+
function create() {
|
|
410
|
+
formreset();
|
|
411
|
+
setShowViewMode(false);
|
|
412
|
+
}
|
|
413
|
+
function edit(data) {
|
|
414
|
+
if (data) {
|
|
415
|
+
reset(data);
|
|
416
|
+
}
|
|
417
|
+
setShowViewMode(false);
|
|
418
|
+
}
|
|
419
|
+
function cancel() {
|
|
420
|
+
setShowViewMode(true);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// Call onDataSourceChange when formfields change
|
|
424
|
+
(0, _react.useEffect)(function () {
|
|
425
|
+
if (props.onDataSourceChange && Object.keys(formfields).length > 0) {
|
|
426
|
+
props.onDataSourceChange(formfields);
|
|
427
|
+
}
|
|
428
|
+
}, [formfields, props.onDataSourceChange]);
|
|
429
|
+
|
|
430
|
+
// Determine form classes based on wizard context
|
|
431
|
+
var formClassName = (0, _react.useMemo)(function () {
|
|
432
|
+
if (isInsideWizard) {
|
|
433
|
+
return (0, _clsx["default"])(props.className);
|
|
434
|
+
}
|
|
435
|
+
return (0, _clsx["default"])(DEFAULT_CLASS, props.className);
|
|
436
|
+
}, [isInsideWizard, props.className]);
|
|
437
|
+
return __jsx("form", (0, _extends2["default"])({
|
|
438
|
+
name: props.name,
|
|
439
|
+
defaultmode: props.defaultmode,
|
|
440
|
+
captionposition: props.captionposition,
|
|
441
|
+
captionalign: props.captionalign,
|
|
442
|
+
numberoffields: Object.keys(formfields).length,
|
|
443
|
+
ref: formRef,
|
|
444
|
+
className: formClassName,
|
|
445
|
+
id: props.id,
|
|
446
|
+
onSubmit: submit
|
|
447
|
+
}, conditionalProps, {
|
|
448
|
+
style: _objectSpread(_objectSpread({}, props.styles), props.conditionalstyle)
|
|
449
|
+
}), __jsx(_formContext.FormProvider, {
|
|
450
|
+
value: ref,
|
|
451
|
+
isViewMode: showViewMode
|
|
452
|
+
}, __jsx(WrappedComponent, (0, _extends2["default"])({}, formProps, {
|
|
453
|
+
valid: isValid,
|
|
454
|
+
formWidgets: formfields,
|
|
455
|
+
formfields: formfields
|
|
456
|
+
}))));
|
|
457
|
+
};
|
|
458
|
+
return ControlledForm;
|
|
459
|
+
};
|
|
460
|
+
var _default = exports["default"] = BaseForm;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultProps = void 0;
|
|
7
|
+
var defaultProps = exports.defaultProps = {
|
|
8
|
+
captionwidth: "xs-12 sm-3 md-3 lg-3",
|
|
9
|
+
captionposition: "left",
|
|
10
|
+
captionalign: "left",
|
|
11
|
+
autocomplete: "off",
|
|
12
|
+
method: "post",
|
|
13
|
+
messagelayout: "Inline",
|
|
14
|
+
postmessage: "Data posted successfully",
|
|
15
|
+
errormessage: "An error occurred. Please try again!",
|
|
16
|
+
tabindex: 0,
|
|
17
|
+
validationtype: "default",
|
|
18
|
+
collapsible: false,
|
|
19
|
+
expanded: true,
|
|
20
|
+
onReset: function onReset() {},
|
|
21
|
+
onSubmit: function onSubmit(event, widget, data) {},
|
|
22
|
+
onError: function onError(event, widget, error) {},
|
|
23
|
+
onSuccess: function onSuccess(event, widget, data) {},
|
|
24
|
+
formsubmit: function formsubmit(event, widget, data) {},
|
|
25
|
+
onChange: function onChange(event, widget, data) {},
|
|
26
|
+
onBeforeSubmit: function onBeforeSubmit(event, widget, data) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isAndroid = exports.getFieldLayoutConfig = void 0;
|
|
7
|
+
var _lodashEs = require("lodash-es");
|
|
8
|
+
var _constant = require("./constant");
|
|
9
|
+
var userAgent = "";
|
|
10
|
+
if (typeof window !== "undefined") {
|
|
11
|
+
userAgent = window.navigator.userAgent;
|
|
12
|
+
}
|
|
13
|
+
var isAndroid = exports.isAndroid = function isAndroid() {
|
|
14
|
+
return _constant.REGEX.ANDROID.test(userAgent);
|
|
15
|
+
};
|
|
16
|
+
var getFieldLayoutConfig = exports.getFieldLayoutConfig = function getFieldLayoutConfig(captionWidth, captionPosition, os) {
|
|
17
|
+
var captionCls = "",
|
|
18
|
+
widgetCls = "";
|
|
19
|
+
captionPosition = captionPosition || "top";
|
|
20
|
+
if (captionPosition === "top" || captionPosition === "floating") {
|
|
21
|
+
if (os && os === "android" || isAndroid()) {
|
|
22
|
+
// Is android or not a mobile application
|
|
23
|
+
captionCls = widgetCls = "col-xs-12";
|
|
24
|
+
}
|
|
25
|
+
} else if (captionWidth) {
|
|
26
|
+
// handling itemsperrow containing string of classes
|
|
27
|
+
(0, _lodashEs.forEach)((0, _lodashEs.split)(captionWidth, " "), function (cls) {
|
|
28
|
+
var keys = (0, _lodashEs.split)(cls, "-"),
|
|
29
|
+
tier = keys[0];
|
|
30
|
+
var _captionWidth, widgetWidth;
|
|
31
|
+
_captionWidth = parseInt(keys[1], 10);
|
|
32
|
+
widgetWidth = 12 - _captionWidth;
|
|
33
|
+
widgetWidth = widgetWidth <= 0 ? 12 : widgetWidth;
|
|
34
|
+
captionCls += " " + "col-" + tier + "-" + _captionWidth;
|
|
35
|
+
widgetCls += " " + "col-" + tier + "-" + widgetWidth;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
captionCls: captionCls,
|
|
40
|
+
widgetCls: widgetCls
|
|
41
|
+
};
|
|
42
|
+
};
|