@wavemaker/react-runtime 11.14.1-15.6409
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,322 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
12
|
+
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
13
|
+
var _withBaseWrapper = require("@wavemaker/react-runtime/higherOrder/withBaseWrapper");
|
|
14
|
+
var _hooks = require("./hooks");
|
|
15
|
+
var _components = require("./components");
|
|
16
|
+
var _constants = require("../list/utils/constants");
|
|
17
|
+
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" != _typeof(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); }
|
|
18
|
+
var __jsx = _react["default"].createElement;
|
|
19
|
+
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; }
|
|
20
|
+
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; }
|
|
21
|
+
var WmPagination = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
22
|
+
var name = props.name,
|
|
23
|
+
dataset = props.dataset,
|
|
24
|
+
_props$maxResults = props.maxResults,
|
|
25
|
+
maxResults = _props$maxResults === void 0 ? 10 : _props$maxResults,
|
|
26
|
+
currentPage = props.currentPage,
|
|
27
|
+
_props$navigation = props.navigation,
|
|
28
|
+
navigation = _props$navigation === void 0 ? _constants.LIST_NAVIGATION_TYPES.BASIC : _props$navigation,
|
|
29
|
+
navigationsize = props.navigationsize,
|
|
30
|
+
_props$navigationalig = props.navigationalign,
|
|
31
|
+
navigationalign = _props$navigationalig === void 0 ? _constants.LIST_ALIGN.LEFT : _props$navigationalig,
|
|
32
|
+
_props$showrecordcoun = props.showrecordcount,
|
|
33
|
+
showrecordcount = _props$showrecordcoun === void 0 ? false : _props$showrecordcoun,
|
|
34
|
+
_props$maxsize = props.maxsize,
|
|
35
|
+
maxsize = _props$maxsize === void 0 ? 5 : _props$maxsize,
|
|
36
|
+
_props$boundarylinks = props.boundarylinks,
|
|
37
|
+
boundarylinks = _props$boundarylinks === void 0 ? false : _props$boundarylinks,
|
|
38
|
+
_props$directionlinks = props.directionlinks,
|
|
39
|
+
directionlinks = _props$directionlinks === void 0 ? true : _props$directionlinks,
|
|
40
|
+
_props$allowpagesizec = props.allowpagesizechange,
|
|
41
|
+
allowpagesizechange = _props$allowpagesizec === void 0 ? false : _props$allowpagesizec,
|
|
42
|
+
_props$pagesizeoption = props.pagesizeoptions,
|
|
43
|
+
pagesizeoptions = _props$pagesizeoption === void 0 ? "5,10,20,50,100" : _props$pagesizeoption,
|
|
44
|
+
className = props.className,
|
|
45
|
+
styles = props.styles,
|
|
46
|
+
listener = props.listener,
|
|
47
|
+
onPaginationChange = props.onPaginationChange,
|
|
48
|
+
onSetRecord = props.onSetRecord,
|
|
49
|
+
onPageSizeChange = props.onPageSizeChange,
|
|
50
|
+
datasource = props.datasource,
|
|
51
|
+
isLoadingMore = props.isLoadingMore,
|
|
52
|
+
setIsLoadingMore = props.setIsLoadingMore,
|
|
53
|
+
isServerSidePagination = props.isServerSidePagination,
|
|
54
|
+
onDataUpdate = props.onDataUpdate;
|
|
55
|
+
|
|
56
|
+
// Custom hooks for pagination logic and navigation sizing
|
|
57
|
+
var pagination = (0, _hooks.usePagination)({
|
|
58
|
+
dataset: dataset,
|
|
59
|
+
maxResults: maxResults,
|
|
60
|
+
currentPage: currentPage,
|
|
61
|
+
navigation: navigation,
|
|
62
|
+
name: name,
|
|
63
|
+
listener: listener,
|
|
64
|
+
onPaginationChange: onPaginationChange,
|
|
65
|
+
onSetRecord: onSetRecord,
|
|
66
|
+
onPageSizeChange: onPageSizeChange,
|
|
67
|
+
paginationMeta: props.paginationMeta,
|
|
68
|
+
totalItems: props.totalItems,
|
|
69
|
+
datasource: datasource,
|
|
70
|
+
isLoadingMore: isLoadingMore,
|
|
71
|
+
setIsLoadingMore: setIsLoadingMore,
|
|
72
|
+
isServerSidePagination: isServerSidePagination,
|
|
73
|
+
datasourceInvokeOptions: props.datasourceInvokeOptions
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// Notify parent component when data changes in Scroll mode
|
|
77
|
+
var prevResultLengthRef = _react["default"].useRef(0);
|
|
78
|
+
_react["default"].useEffect(function () {
|
|
79
|
+
if (navigation === "Scroll" && onDataUpdate && pagination.result) {
|
|
80
|
+
// Only update if the result length has changed (new data added)
|
|
81
|
+
if (pagination.result.length !== prevResultLengthRef.current) {
|
|
82
|
+
prevResultLengthRef.current = pagination.result.length;
|
|
83
|
+
onDataUpdate(pagination.result);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}, [navigation, onDataUpdate, pagination.result]);
|
|
87
|
+
var _useNavigationSize = (0, _hooks.useNavigationSize)({
|
|
88
|
+
navigation: navigation,
|
|
89
|
+
navigationsize: navigationsize
|
|
90
|
+
}),
|
|
91
|
+
navigationClass = _useNavigationSize.navigationClass;
|
|
92
|
+
|
|
93
|
+
// Memoized flex container styles for better performance
|
|
94
|
+
var flexContainerStyles = (0, _react.useMemo)(function () {
|
|
95
|
+
var baseStyles = {
|
|
96
|
+
display: "flex",
|
|
97
|
+
alignItems: "center",
|
|
98
|
+
width: "100%",
|
|
99
|
+
gap: 2
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// When showrecordcount is false, align based on navigationalign
|
|
103
|
+
// When showrecordcount is true, use space-between for proper distribution
|
|
104
|
+
if (!showrecordcount) {
|
|
105
|
+
return _objectSpread(_objectSpread({}, baseStyles), {}, {
|
|
106
|
+
justifyContent: navigationalign === "right" ? "flex-end" : navigationalign === "center" ? "center" : "flex-start"
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return _objectSpread(_objectSpread({}, baseStyles), {}, {
|
|
110
|
+
justifyContent: "space-between"
|
|
111
|
+
});
|
|
112
|
+
}, [showrecordcount, navigationalign]);
|
|
113
|
+
|
|
114
|
+
// Memoized common page size selector
|
|
115
|
+
var pageSizeSelector = (0, _react.useMemo)(function () {
|
|
116
|
+
if (!allowpagesizechange) return null;
|
|
117
|
+
return __jsx(_components.PageSizeSelector, {
|
|
118
|
+
pagesizeoptions: pagesizeoptions,
|
|
119
|
+
maxResults: pagination.currentMaxResults,
|
|
120
|
+
currentPage: pagination.currentPage,
|
|
121
|
+
dataSize: pagination.dataSize,
|
|
122
|
+
paginationMeta: props.paginationMeta,
|
|
123
|
+
onPageSizeChange: pagination.handlePageSizeChange
|
|
124
|
+
});
|
|
125
|
+
}, [allowpagesizechange, pagesizeoptions, pagination.currentMaxResults, pagination.currentPage, pagination.dataSize, pagination.handlePageSizeChange, props.paginationMeta]);
|
|
126
|
+
|
|
127
|
+
// Simple layout helper function - not memoized to avoid dependency issues
|
|
128
|
+
var renderWithLayout = function renderWithLayout(children, recordCountVariant) {
|
|
129
|
+
// When showrecordcount is false, use simple flex container with alignment
|
|
130
|
+
if (!showrecordcount) {
|
|
131
|
+
return __jsx(_Box["default"], {
|
|
132
|
+
sx: flexContainerStyles
|
|
133
|
+
}, __jsx(_Box["default"], {
|
|
134
|
+
sx: {
|
|
135
|
+
display: "flex",
|
|
136
|
+
alignItems: "center",
|
|
137
|
+
gap: 2
|
|
138
|
+
}
|
|
139
|
+
}, children));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// When showrecordcount is true, use complex layout with proper distribution
|
|
143
|
+
if (navigationalign === "center") {
|
|
144
|
+
return __jsx(_Box["default"], {
|
|
145
|
+
sx: flexContainerStyles
|
|
146
|
+
}, __jsx(_Box["default"], {
|
|
147
|
+
sx: {
|
|
148
|
+
flex: 1
|
|
149
|
+
}
|
|
150
|
+
}), __jsx(_Box["default"], {
|
|
151
|
+
sx: {
|
|
152
|
+
display: "flex",
|
|
153
|
+
alignItems: "center",
|
|
154
|
+
gap: 2
|
|
155
|
+
}
|
|
156
|
+
}, children, __jsx(_components.TotalRecords, {
|
|
157
|
+
dataSize: pagination.dataSize,
|
|
158
|
+
variant: recordCountVariant
|
|
159
|
+
})), __jsx(_Box["default"], {
|
|
160
|
+
sx: {
|
|
161
|
+
flex: 1
|
|
162
|
+
}
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
return __jsx(_Box["default"], {
|
|
166
|
+
sx: flexContainerStyles
|
|
167
|
+
}, __jsx(_Box["default"], {
|
|
168
|
+
sx: {
|
|
169
|
+
display: "flex",
|
|
170
|
+
alignItems: "center",
|
|
171
|
+
gap: 2,
|
|
172
|
+
order: navigationalign === "right" ? 2 : 1
|
|
173
|
+
}
|
|
174
|
+
}, children), __jsx(_Box["default"], {
|
|
175
|
+
sx: {
|
|
176
|
+
order: navigationalign === "right" ? 1 : 2
|
|
177
|
+
}
|
|
178
|
+
}, __jsx(_components.TotalRecords, {
|
|
179
|
+
dataSize: pagination.dataSize,
|
|
180
|
+
variant: recordCountVariant
|
|
181
|
+
})));
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
// Render navigation components directly - avoid over-memoization
|
|
185
|
+
var renderNavigation = function renderNavigation() {
|
|
186
|
+
// Only show navigation when there are multiple pages (i.e., not all items are visible on current page)
|
|
187
|
+
var showNavigation = pagination.pageCount > 1;
|
|
188
|
+
switch (pagination.navcontrols) {
|
|
189
|
+
case "Basic":
|
|
190
|
+
return showNavigation ? __jsx(_components.BasicPagination, {
|
|
191
|
+
pageCount: pagination.pageCount,
|
|
192
|
+
currentPage: pagination.currentPage,
|
|
193
|
+
dataSize: pagination.dataSize,
|
|
194
|
+
maxResults: pagination.currentMaxResults,
|
|
195
|
+
boundarylinks: boundarylinks,
|
|
196
|
+
directionlinks: directionlinks,
|
|
197
|
+
navigationsize: navigationsize,
|
|
198
|
+
navigationClass: navigationClass,
|
|
199
|
+
maxsize: maxsize,
|
|
200
|
+
onPageChange: pagination.handlePageChange
|
|
201
|
+
}) : null;
|
|
202
|
+
case "Classic":
|
|
203
|
+
return showNavigation ? __jsx(_components.ClassicPagination, {
|
|
204
|
+
currentPage: pagination.currentPage,
|
|
205
|
+
pageCount: pagination.pageCount,
|
|
206
|
+
dataSize: pagination.dataSize,
|
|
207
|
+
maxResults: pagination.currentMaxResults,
|
|
208
|
+
navigationClass: navigationClass,
|
|
209
|
+
showrecordcount: false,
|
|
210
|
+
isDisableFirst: pagination.isDisableFirst,
|
|
211
|
+
isDisablePrevious: pagination.isDisablePrevious,
|
|
212
|
+
isDisableNext: pagination.isDisableNext,
|
|
213
|
+
isDisableLast: pagination.isDisableLast,
|
|
214
|
+
isDisableCurrent: pagination.isDisableCurrent,
|
|
215
|
+
isDisableCount: pagination.isDisableCount,
|
|
216
|
+
onNavigate: pagination.navigatePage,
|
|
217
|
+
onInputChange: pagination.handleInputChange,
|
|
218
|
+
onModelChange: pagination.onModelChange,
|
|
219
|
+
onKeyDown: pagination.onKeyDown
|
|
220
|
+
}) : null;
|
|
221
|
+
case "Pager":
|
|
222
|
+
return showNavigation ? __jsx(_components.PagerNavigation, {
|
|
223
|
+
navigationClass: navigationClass,
|
|
224
|
+
isDisablePrevious: pagination.isDisablePrevious,
|
|
225
|
+
isDisableNext: pagination.isDisableNext,
|
|
226
|
+
onNavigate: pagination.navigatePage
|
|
227
|
+
}) : null;
|
|
228
|
+
case "Scroll":
|
|
229
|
+
// For scroll navigation, render a sentinel element for intersection observer
|
|
230
|
+
return null;
|
|
231
|
+
// Navigation controls not needed for infinite scroll
|
|
232
|
+
|
|
233
|
+
default:
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
// Simple render function - avoid over-optimization that causes re-renders
|
|
239
|
+
var renderPaginationContent = function renderPaginationContent() {
|
|
240
|
+
var navigationComponent = renderNavigation();
|
|
241
|
+
var content = __jsx(_react["default"].Fragment, null, pageSizeSelector, navigationComponent);
|
|
242
|
+
|
|
243
|
+
// Return early if no content to render
|
|
244
|
+
if (!pageSizeSelector && !navigationComponent) {
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// Get the appropriate record count variant based on navigation type
|
|
249
|
+
var recordCountVariant = pagination.navcontrols === "Classic" ? "Classic" : "Basic";
|
|
250
|
+
return renderWithLayout(content, recordCountVariant);
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
// Render infinite scroll content
|
|
254
|
+
if (pagination.navcontrols === "Scroll") {
|
|
255
|
+
return __jsx(_Box["default"], {
|
|
256
|
+
className: (0, _clsx["default"])("app-datanavigator clearfix", className),
|
|
257
|
+
sx: _objectSpread(_objectSpread({}, styles), {}, {
|
|
258
|
+
width: "100%",
|
|
259
|
+
position: "relative"
|
|
260
|
+
}),
|
|
261
|
+
id: name
|
|
262
|
+
}, pagination.isLoadingMore && __jsx(_Box["default"], {
|
|
263
|
+
sx: {
|
|
264
|
+
display: "flex",
|
|
265
|
+
justifyContent: "center",
|
|
266
|
+
alignItems: "center",
|
|
267
|
+
padding: 2,
|
|
268
|
+
width: "100%",
|
|
269
|
+
textAlign: "center"
|
|
270
|
+
}
|
|
271
|
+
}, __jsx(_Box["default"], {
|
|
272
|
+
className: "status"
|
|
273
|
+
}, __jsx("i", {
|
|
274
|
+
className: "fa fa-circle-o-notch fa-spin"
|
|
275
|
+
}), __jsx(_Box["default"], {
|
|
276
|
+
component: "span",
|
|
277
|
+
className: "message",
|
|
278
|
+
sx: {
|
|
279
|
+
marginLeft: 1
|
|
280
|
+
}
|
|
281
|
+
}, "Loading..."))), !pagination.hasMoreData && pagination.dataSize > 0 && __jsx(_Box["default"], {
|
|
282
|
+
sx: {
|
|
283
|
+
display: "flex",
|
|
284
|
+
justifyContent: "center",
|
|
285
|
+
alignItems: "center",
|
|
286
|
+
padding: 2,
|
|
287
|
+
width: "100%",
|
|
288
|
+
textAlign: "center",
|
|
289
|
+
color: "text.secondary"
|
|
290
|
+
}
|
|
291
|
+
}, __jsx("span", null, "No more data to load")), __jsx(_Box["default"], {
|
|
292
|
+
ref: function ref(el) {
|
|
293
|
+
if (pagination.sentinelRef) {
|
|
294
|
+
pagination.sentinelRef.current = el;
|
|
295
|
+
}
|
|
296
|
+
// Observer setup is handled by useEffect in the hook when data is initialized
|
|
297
|
+
},
|
|
298
|
+
sx: {
|
|
299
|
+
position: "absolute",
|
|
300
|
+
bottom: 0,
|
|
301
|
+
left: 0,
|
|
302
|
+
right: 0,
|
|
303
|
+
height: "1px",
|
|
304
|
+
visibility: "hidden",
|
|
305
|
+
pointerEvents: "none"
|
|
306
|
+
},
|
|
307
|
+
"aria-hidden": "true"
|
|
308
|
+
}));
|
|
309
|
+
}
|
|
310
|
+
return __jsx(_Box["default"], {
|
|
311
|
+
className: (0, _clsx["default"])("app-datanavigator clearfix", className),
|
|
312
|
+
sx: _objectSpread(_objectSpread({}, styles), {}, {
|
|
313
|
+
width: "100%"
|
|
314
|
+
}),
|
|
315
|
+
id: name,
|
|
316
|
+
onClick: function onClick(e) {
|
|
317
|
+
return e.stopPropagation();
|
|
318
|
+
}
|
|
319
|
+
}, renderPaginationContent());
|
|
320
|
+
});
|
|
321
|
+
WmPagination.displayName = "WmPagination";
|
|
322
|
+
var _default = exports["default"] = (0, _withBaseWrapper.withBaseWrapper)(WmPagination);
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.AddNewRow = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
var _lodashEs = require("lodash-es");
|
|
11
|
+
var _tableRowAction = _interopRequireDefault(require("../table-row-action"));
|
|
12
|
+
var __jsx = _react["default"].createElement;
|
|
13
|
+
// Helper function to create empty cells
|
|
14
|
+
var createEmptyCell = function createEmptyCell(key) {
|
|
15
|
+
var className = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "text-center";
|
|
16
|
+
return __jsx(_material.TableCell, {
|
|
17
|
+
key: key
|
|
18
|
+
}, __jsx(_material.Box, {
|
|
19
|
+
className: className
|
|
20
|
+
}));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// Helper function to create action buttons
|
|
24
|
+
var createActionButton = function createActionButton(key, name, actionKey, title, iconClass, _onClick, listener) {
|
|
25
|
+
return __jsx(_tableRowAction["default"], {
|
|
26
|
+
key: key,
|
|
27
|
+
name: name,
|
|
28
|
+
className: "".concat(actionKey === "acceptNew" ? "save" : "cancel", " row-action-button btn app-button btn-transparent ").concat(name, "-button"),
|
|
29
|
+
"data-action-key": actionKey,
|
|
30
|
+
displayName: "",
|
|
31
|
+
title: title,
|
|
32
|
+
iconclass: iconClass,
|
|
33
|
+
action: actionKey === "acceptNew" ? "save" : "cancel",
|
|
34
|
+
row: {},
|
|
35
|
+
rowIndex: -1,
|
|
36
|
+
listener: listener,
|
|
37
|
+
show: true,
|
|
38
|
+
onClick: function onClick(event) {
|
|
39
|
+
event === null || event === void 0 || event.preventDefault();
|
|
40
|
+
event === null || event === void 0 || event.stopPropagation();
|
|
41
|
+
_onClick();
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// Helper function to create action buttons cell
|
|
47
|
+
var createActionButtonsCell = function createActionButtonsCell(key, editMode, onSave, onCancel, listener) {
|
|
48
|
+
return __jsx(_material.TableCell, {
|
|
49
|
+
key: key
|
|
50
|
+
}, __jsx(_material.Box, {
|
|
51
|
+
component: "span",
|
|
52
|
+
className: "actions-column"
|
|
53
|
+
}, editMode === "inline" ?
|
|
54
|
+
// Show save/cancel buttons for inline edit
|
|
55
|
+
__jsx(_react["default"].Fragment, null, createActionButton("accept-new", "accept-new-row", "acceptNew", "Save", "wi wi-done", onSave, listener), createActionButton("cancel-new", "cancel-new-row", "cancelNew", "Cancel", "wi wi-cancel", onCancel, listener)) :
|
|
56
|
+
// No actions for quick edit mode
|
|
57
|
+
null));
|
|
58
|
+
};
|
|
59
|
+
var AddNewRow = exports.AddNewRow = function AddNewRow(_ref) {
|
|
60
|
+
var isAddingNewRow = _ref.isAddingNewRow,
|
|
61
|
+
editMode = _ref.editMode,
|
|
62
|
+
wmTableColumns = _ref.wmTableColumns,
|
|
63
|
+
rowActions = _ref.rowActions,
|
|
64
|
+
showrowindex = _ref.showrowindex,
|
|
65
|
+
_ref$radioselect = _ref.radioselect,
|
|
66
|
+
radioselect = _ref$radioselect === void 0 ? false : _ref$radioselect,
|
|
67
|
+
_ref$multiselect = _ref.multiselect,
|
|
68
|
+
multiselect = _ref$multiselect === void 0 ? false : _ref$multiselect,
|
|
69
|
+
sessionKey = _ref.sessionKey,
|
|
70
|
+
editingRowData = _ref.editingRowData,
|
|
71
|
+
renderEditableCell = _ref.renderEditableCell,
|
|
72
|
+
onKeyDown = _ref.onKeyDown,
|
|
73
|
+
onSave = _ref.handleSave,
|
|
74
|
+
onCancel = _ref.handleCancel,
|
|
75
|
+
listener = _ref.listener,
|
|
76
|
+
_ref$hasRowExpansion = _ref.hasRowExpansion,
|
|
77
|
+
hasRowExpansion = _ref$hasRowExpansion === void 0 ? false : _ref$hasRowExpansion,
|
|
78
|
+
_ref$expansionPositio = _ref.expansionPosition,
|
|
79
|
+
expansionPosition = _ref$expansionPositio === void 0 ? 0 : _ref$expansionPositio;
|
|
80
|
+
if (!isAddingNewRow || editMode !== "inline" && editMode !== "quickedit") {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
var rowKey = editMode === "quickedit" ? "quick-edit-new-row" : "add-new-row";
|
|
84
|
+
|
|
85
|
+
// Filter visible columns and separate manual action column
|
|
86
|
+
var allVisibleColumns = (0, _lodashEs.filter)(wmTableColumns, function (col) {
|
|
87
|
+
return col.show !== false;
|
|
88
|
+
});
|
|
89
|
+
var manualActionColumn = allVisibleColumns.find(function (col) {
|
|
90
|
+
return col.binding === "rowOperations";
|
|
91
|
+
});
|
|
92
|
+
var visibleColumns = allVisibleColumns.filter(function (col) {
|
|
93
|
+
return col.binding !== "rowOperations";
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// Calculate total columns including system columns
|
|
97
|
+
var totalCells = [];
|
|
98
|
+
|
|
99
|
+
// Add selection column
|
|
100
|
+
if (radioselect || multiselect) {
|
|
101
|
+
totalCells.push(createEmptyCell("".concat(rowKey, "-selection")));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Add row index column
|
|
105
|
+
if (showrowindex) {
|
|
106
|
+
totalCells.push(createEmptyCell("".concat(rowKey, "-index")));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Add manual action column if positioned at 0
|
|
110
|
+
if (manualActionColumn && manualActionColumn.rowactionsposition === 0) {
|
|
111
|
+
totalCells.push(createActionButtonsCell("".concat(rowKey, "-manual-actions"), editMode, onSave, onCancel, listener));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Calculate expansion cell position
|
|
115
|
+
var dataColumnStartIndex = totalCells.length;
|
|
116
|
+
var calculateExpansionIndex = function calculateExpansionIndex() {
|
|
117
|
+
if (!hasRowExpansion) return -1;
|
|
118
|
+
|
|
119
|
+
// Handle numeric positions
|
|
120
|
+
if (typeof expansionPosition === "number" || !isNaN(Number(expansionPosition))) {
|
|
121
|
+
return dataColumnStartIndex + Number(expansionPosition);
|
|
122
|
+
}
|
|
123
|
+
// Handle -1 position (after all columns)
|
|
124
|
+
else if (expansionPosition === "-1" || String(expansionPosition) === "-1") {
|
|
125
|
+
return dataColumnStartIndex + visibleColumns.length;
|
|
126
|
+
}
|
|
127
|
+
// Handle column name positions
|
|
128
|
+
else if (typeof expansionPosition === "string") {
|
|
129
|
+
// For nested paths like "name.location.url", we need to match the exact field value
|
|
130
|
+
var columnIndex = visibleColumns.findIndex(function (col) {
|
|
131
|
+
return col.field === expansionPosition || col.binding === expansionPosition;
|
|
132
|
+
});
|
|
133
|
+
// Place AFTER the named column
|
|
134
|
+
return columnIndex >= 0 ? dataColumnStartIndex + columnIndex + 1 : dataColumnStartIndex;
|
|
135
|
+
}
|
|
136
|
+
// Default to beginning
|
|
137
|
+
return dataColumnStartIndex;
|
|
138
|
+
};
|
|
139
|
+
var expansionInsertIndex = calculateExpansionIndex();
|
|
140
|
+
|
|
141
|
+
// Add expansion cell at the beginning if it's positioned before all data columns
|
|
142
|
+
var expansionCellAdded = false;
|
|
143
|
+
if (hasRowExpansion && expansionInsertIndex === dataColumnStartIndex) {
|
|
144
|
+
totalCells.push(createEmptyCell("".concat(rowKey, "-expansion")));
|
|
145
|
+
expansionCellAdded = true;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Add data columns
|
|
149
|
+
for (var index = 0; index < visibleColumns.length; index++) {
|
|
150
|
+
var _ref2, _editingRowData$field;
|
|
151
|
+
var column = visibleColumns[index];
|
|
152
|
+
var actualIndex = dataColumnStartIndex + index;
|
|
153
|
+
|
|
154
|
+
// Insert expansion cell at calculated position
|
|
155
|
+
if (hasRowExpansion && actualIndex === expansionInsertIndex && !expansionCellAdded) {
|
|
156
|
+
totalCells.push(createEmptyCell("".concat(rowKey, "-expansion")));
|
|
157
|
+
expansionCellAdded = true;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Insert manual action column if positioned at this index
|
|
161
|
+
if (manualActionColumn && manualActionColumn.rowactionsposition !== undefined && manualActionColumn.rowactionsposition !== 0 && Number(manualActionColumn.rowactionsposition) === index + 1) {
|
|
162
|
+
totalCells.push(createActionButtonsCell("".concat(rowKey, "-manual-actions"), editMode, onSave, onCancel, listener));
|
|
163
|
+
}
|
|
164
|
+
var fieldName = String(column.field || "field_".concat(index));
|
|
165
|
+
var widgetType = String(column.editWidgetType || "WmText");
|
|
166
|
+
var editValue = (_ref2 = (_editingRowData$field = editingRowData[fieldName]) !== null && _editingRowData$field !== void 0 ? _editingRowData$field : column.defaultvalue) !== null && _ref2 !== void 0 ? _ref2 : "";
|
|
167
|
+
totalCells.push(__jsx(_material.TableCell, {
|
|
168
|
+
key: "new-row-".concat(fieldName)
|
|
169
|
+
}, column.readonly ? __jsx(_react["default"].Fragment, null) : renderEditableCell(column, fieldName, widgetType, editValue, "new-row")));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Add expansion cell at the end if it's positioned after all data columns
|
|
173
|
+
if (hasRowExpansion && expansionInsertIndex === dataColumnStartIndex + visibleColumns.length && !expansionCellAdded) {
|
|
174
|
+
totalCells.push(createEmptyCell("".concat(rowKey, "-expansion")));
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Add manual action column at the end if not already added
|
|
178
|
+
if (manualActionColumn && (manualActionColumn.rowactionsposition === undefined || manualActionColumn.rowactionsposition === -1 || Number(manualActionColumn.rowactionsposition) > visibleColumns.length)) {
|
|
179
|
+
totalCells.push(createActionButtonsCell("".concat(rowKey, "-manual-actions"), editMode, onSave, onCancel, listener));
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Add default actions column if no manual action column
|
|
183
|
+
if (!manualActionColumn && rowActions.length > 0) {
|
|
184
|
+
totalCells.push(createActionButtonsCell("".concat(rowKey, "-actions"), editMode, onSave, onCancel, listener));
|
|
185
|
+
}
|
|
186
|
+
return __jsx(_material.TableRow, {
|
|
187
|
+
className: "add-new-row",
|
|
188
|
+
key: rowKey
|
|
189
|
+
}, totalCells);
|
|
190
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = exports.EditableCell = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
var _FieldValidationError = require("./FieldValidationError");
|
|
11
|
+
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" != _typeof(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); }
|
|
12
|
+
var __jsx = _react["default"].createElement;
|
|
13
|
+
var EditableCell = exports.EditableCell = function EditableCell(_ref) {
|
|
14
|
+
var _fieldValidationError;
|
|
15
|
+
var column = _ref.column,
|
|
16
|
+
rowData = _ref.rowData,
|
|
17
|
+
rowId = _ref.rowId,
|
|
18
|
+
fieldName = _ref.fieldName,
|
|
19
|
+
widgetType = _ref.widgetType,
|
|
20
|
+
editValue = _ref.editValue,
|
|
21
|
+
fieldValidationErrorsRef = _ref.fieldValidationErrorsRef,
|
|
22
|
+
cellUpdateCallbacksRef = _ref.cellUpdateCallbacksRef,
|
|
23
|
+
fieldRefs = _ref.fieldRefs,
|
|
24
|
+
renderFormWidget = _ref.renderFormWidget,
|
|
25
|
+
updateFieldValue = _ref.updateFieldValue,
|
|
26
|
+
_ref$sessionKey = _ref.sessionKey,
|
|
27
|
+
sessionKey = _ref$sessionKey === void 0 ? 0 : _ref$sessionKey,
|
|
28
|
+
onKeyDown = _ref.onKeyDown,
|
|
29
|
+
_ref$editMode = _ref.editMode,
|
|
30
|
+
editMode = _ref$editMode === void 0 ? "inline" : _ref$editMode;
|
|
31
|
+
var cellRef = (0, _react.useRef)(null);
|
|
32
|
+
var _useState = (0, _react.useState)(0),
|
|
33
|
+
setForceUpdate = _useState[1];
|
|
34
|
+
|
|
35
|
+
// Generate a unique field key for validation tracking
|
|
36
|
+
var fieldKey = "".concat(rowId, "_").concat(fieldName);
|
|
37
|
+
|
|
38
|
+
// Create a ref callback to register the cell element for validation
|
|
39
|
+
var cellRefCallback = function cellRefCallback(element) {
|
|
40
|
+
cellRef.current = element;
|
|
41
|
+
if (element && fieldRefs.current) {
|
|
42
|
+
fieldRefs.current[fieldKey] = element;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// Register a cell update callback to force re-render on validation state changes
|
|
47
|
+
(0, _react.useEffect)(function () {
|
|
48
|
+
if (cellUpdateCallbacksRef.current) {
|
|
49
|
+
cellUpdateCallbacksRef.current[fieldKey] = function () {
|
|
50
|
+
return setForceUpdate(function (prev) {
|
|
51
|
+
return prev + 1;
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
return function () {
|
|
56
|
+
if (cellUpdateCallbacksRef.current) {
|
|
57
|
+
delete cellUpdateCallbacksRef.current[fieldKey];
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}, [fieldKey, cellUpdateCallbacksRef]);
|
|
61
|
+
|
|
62
|
+
// Determine if we should show validation error
|
|
63
|
+
var showError = ((_fieldValidationError = fieldValidationErrorsRef.current) === null || _fieldValidationError === void 0 ? void 0 : _fieldValidationError[fieldKey]) === true;
|
|
64
|
+
|
|
65
|
+
// Handle keyboard events for quick edit mode
|
|
66
|
+
var handleKeyDown = function handleKeyDown(e) {
|
|
67
|
+
if (onKeyDown) {
|
|
68
|
+
onKeyDown(e, rowId);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
return __jsx(_material.Box, {
|
|
72
|
+
ref: cellRefCallback,
|
|
73
|
+
onKeyDown: editMode === "quickedit" ? handleKeyDown : undefined,
|
|
74
|
+
"data-field-name": fieldName,
|
|
75
|
+
"data-row-id": rowId
|
|
76
|
+
}, renderFormWidget(fieldName, widgetType, editValue, function (newValue) {
|
|
77
|
+
return updateFieldValue(fieldName, newValue, rowId);
|
|
78
|
+
}, {
|
|
79
|
+
required: column.required,
|
|
80
|
+
disabled: column.disabled,
|
|
81
|
+
placeholder: column.placeholder,
|
|
82
|
+
defaultvalue: column.defaultvalue,
|
|
83
|
+
sessionKey: "".concat(sessionKey, "_").concat(rowId, "_").concat(fieldName),
|
|
84
|
+
rowData: rowData,
|
|
85
|
+
column: column
|
|
86
|
+
}), showError && __jsx(_FieldValidationError.FieldValidationError, {
|
|
87
|
+
showError: true,
|
|
88
|
+
title: column.required ? "This field is required" : "Field validation failed"
|
|
89
|
+
}));
|
|
90
|
+
};
|
|
91
|
+
var _default = exports["default"] = EditableCell;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = exports.FieldValidationError = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var __jsx = _react["default"].createElement;
|
|
10
|
+
var FieldValidationError = exports.FieldValidationError = function FieldValidationError(_ref) {
|
|
11
|
+
var showError = _ref.showError,
|
|
12
|
+
_ref$title = _ref.title,
|
|
13
|
+
title = _ref$title === void 0 ? "Field validation failed" : _ref$title;
|
|
14
|
+
if (!showError) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return __jsx("span", {
|
|
18
|
+
className: "text-danger wi wi-error",
|
|
19
|
+
"data-placement": "top",
|
|
20
|
+
"data-container": "body",
|
|
21
|
+
title: title
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
var _default = exports["default"] = FieldValidationError;
|