@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,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useCellState = exports.setSelectedRowIds = exports.setSelectedRowId = exports.setCellValue = exports.getSelectedRowIds = exports.getSelectedRowId = exports.getCellValue = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _lodashEs = require("lodash-es");
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
/**
|
|
12
|
+
* Generic hook to manage table state
|
|
13
|
+
* @param tableId - Unique identifier for the table instance (e.g., table name)
|
|
14
|
+
*/
|
|
15
|
+
var useCellState = exports.useCellState = function useCellState(tableId) {
|
|
16
|
+
// Store state with initial structure
|
|
17
|
+
var stateRef = (0, _react.useRef)({
|
|
18
|
+
cells: {},
|
|
19
|
+
selection: {
|
|
20
|
+
selectedRowId: null,
|
|
21
|
+
selectedRowIds: []
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Get a value from the state using lodash path
|
|
26
|
+
var getValue = (0, _react.useCallback)(function (path, defaultValue) {
|
|
27
|
+
return (0, _lodashEs.get)(stateRef.current, path, defaultValue);
|
|
28
|
+
}, []);
|
|
29
|
+
|
|
30
|
+
// Set a value in the state using lodash path
|
|
31
|
+
var setValue = (0, _react.useCallback)(function (path, value) {
|
|
32
|
+
var existingValue = (0, _lodashEs.get)(stateRef.current, path);
|
|
33
|
+
|
|
34
|
+
// Only set if different
|
|
35
|
+
if (!(0, _lodashEs.isEqual)(existingValue, value)) {
|
|
36
|
+
(0, _lodashEs.set)(stateRef.current, path, value);
|
|
37
|
+
}
|
|
38
|
+
}, []);
|
|
39
|
+
|
|
40
|
+
// Update multiple fields at once
|
|
41
|
+
var updateState = (0, _react.useCallback)(function (updates) {
|
|
42
|
+
if (typeof updates === "function") {
|
|
43
|
+
stateRef.current = updates((0, _lodashEs.cloneDeep)(stateRef.current));
|
|
44
|
+
} else {
|
|
45
|
+
Object.entries(updates).forEach(function (_ref) {
|
|
46
|
+
var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
|
|
47
|
+
path = _ref2[0],
|
|
48
|
+
value = _ref2[1];
|
|
49
|
+
(0, _lodashEs.set)(stateRef.current, path, value);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}, []);
|
|
53
|
+
|
|
54
|
+
// Check if a path exists
|
|
55
|
+
var hasValue = (0, _react.useCallback)(function (path) {
|
|
56
|
+
return (0, _lodashEs.has)(stateRef.current, path);
|
|
57
|
+
}, []);
|
|
58
|
+
|
|
59
|
+
// Remove a value
|
|
60
|
+
var removeValue = (0, _react.useCallback)(function (path) {
|
|
61
|
+
(0, _lodashEs.unset)(stateRef.current, path);
|
|
62
|
+
}, []);
|
|
63
|
+
|
|
64
|
+
// Clear all state
|
|
65
|
+
var clearState = (0, _react.useCallback)(function () {
|
|
66
|
+
stateRef.current = {
|
|
67
|
+
cells: {},
|
|
68
|
+
selection: {
|
|
69
|
+
selectedRowId: null,
|
|
70
|
+
selectedRowIds: []
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}, []);
|
|
74
|
+
|
|
75
|
+
// Get the entire state
|
|
76
|
+
var getState = (0, _react.useCallback)(function () {
|
|
77
|
+
return (0, _lodashEs.cloneDeep)(stateRef.current);
|
|
78
|
+
}, []);
|
|
79
|
+
|
|
80
|
+
// Set the entire state
|
|
81
|
+
var setState = (0, _react.useCallback)(function (state) {
|
|
82
|
+
stateRef.current = (0, _lodashEs.cloneDeep)(state);
|
|
83
|
+
}, []);
|
|
84
|
+
return {
|
|
85
|
+
getValue: getValue,
|
|
86
|
+
setValue: setValue,
|
|
87
|
+
updateState: updateState,
|
|
88
|
+
hasValue: hasValue,
|
|
89
|
+
removeValue: removeValue,
|
|
90
|
+
clearState: clearState,
|
|
91
|
+
getState: getState,
|
|
92
|
+
setState: setState,
|
|
93
|
+
tableId: tableId
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// Helper functions for common operations
|
|
98
|
+
var getCellValue = exports.getCellValue = function getCellValue(state, rowId, fieldName, defaultValue) {
|
|
99
|
+
return state.getValue(["cells", rowId, fieldName], defaultValue);
|
|
100
|
+
};
|
|
101
|
+
var setCellValue = exports.setCellValue = function setCellValue(state, rowId, fieldName, value) {
|
|
102
|
+
state.setValue(["cells", rowId, fieldName], value);
|
|
103
|
+
};
|
|
104
|
+
var getSelectedRowId = exports.getSelectedRowId = function getSelectedRowId(state) {
|
|
105
|
+
var _state$getValue;
|
|
106
|
+
return (_state$getValue = state.getValue("selection.selectedRowId", null)) !== null && _state$getValue !== void 0 ? _state$getValue : null;
|
|
107
|
+
};
|
|
108
|
+
var setSelectedRowId = exports.setSelectedRowId = function setSelectedRowId(state, rowId) {
|
|
109
|
+
state.setValue("selection.selectedRowId", rowId);
|
|
110
|
+
};
|
|
111
|
+
var getSelectedRowIds = exports.getSelectedRowIds = function getSelectedRowIds(state) {
|
|
112
|
+
var _state$getValue2;
|
|
113
|
+
return (_state$getValue2 = state.getValue("selection.selectedRowIds", [])) !== null && _state$getValue2 !== void 0 ? _state$getValue2 : [];
|
|
114
|
+
};
|
|
115
|
+
var setSelectedRowIds = exports.setSelectedRowIds = function setSelectedRowIds(state, rowIds) {
|
|
116
|
+
state.setValue("selection.selectedRowIds", rowIds);
|
|
117
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
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.useDynamicColumns = exports["default"] = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _dynamicColumns = require("../utils/dynamic-columns");
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
/**
|
|
16
|
+
* Props for useDynamicColumns hook
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Return type for useDynamicColumns hook
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Hook to generate dynamic table columns when no wmTableColumns children are provided
|
|
25
|
+
*
|
|
26
|
+
* This hook automatically detects when:
|
|
27
|
+
* - No children columns are provided (React.Children.count(children) === 0)
|
|
28
|
+
* - Dataset contains valid data
|
|
29
|
+
*
|
|
30
|
+
* When both conditions are met, it generates column definitions from the data,
|
|
31
|
+
* similar to Angular's dynamic table behavior.
|
|
32
|
+
*
|
|
33
|
+
* @param dataset - Array of data objects
|
|
34
|
+
* @param children - React children (wmTableColumns)
|
|
35
|
+
* @param listener - Component listener for event handling
|
|
36
|
+
* @returns Object containing dynamicColumns and isDynamicTable flag
|
|
37
|
+
*/
|
|
38
|
+
var useDynamicColumns = exports.useDynamicColumns = function useDynamicColumns(_ref) {
|
|
39
|
+
var dataset = _ref.dataset,
|
|
40
|
+
children = _ref.children,
|
|
41
|
+
listener = _ref.listener;
|
|
42
|
+
var _useMemo = (0, _react.useMemo)(function () {
|
|
43
|
+
// Check if children are provided (static columns exist)
|
|
44
|
+
var hasChildren = _react["default"].Children.count(children) > 0;
|
|
45
|
+
|
|
46
|
+
// If children exist, don't generate dynamic columns
|
|
47
|
+
if (hasChildren) {
|
|
48
|
+
return {
|
|
49
|
+
dynamicColumns: [],
|
|
50
|
+
isDynamicTable: false
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Check if data is valid for column generation
|
|
55
|
+
if (!(0, _dynamicColumns.isValidDataForColumns)(dataset)) {
|
|
56
|
+
// For dynamic tables, return an empty state but mark as dynamic
|
|
57
|
+
// This prevents falling back to static columns when data is just loading
|
|
58
|
+
return {
|
|
59
|
+
dynamicColumns: [],
|
|
60
|
+
isDynamicTable: hasChildren === false // Only true if explicitly no children
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Generate columns from data
|
|
65
|
+
var generatedColumns = (0, _dynamicColumns.generateColumnsFromData)(dataset);
|
|
66
|
+
|
|
67
|
+
// Set listener on all generated columns
|
|
68
|
+
var columnsWithListener = generatedColumns.map(function (col) {
|
|
69
|
+
return _objectSpread(_objectSpread({}, col), {}, {
|
|
70
|
+
listener: listener
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
dynamicColumns: columnsWithListener,
|
|
75
|
+
isDynamicTable: true
|
|
76
|
+
};
|
|
77
|
+
}, [dataset, children, listener]),
|
|
78
|
+
dynamicColumns = _useMemo.dynamicColumns,
|
|
79
|
+
isDynamicTable = _useMemo.isDynamicTable;
|
|
80
|
+
return {
|
|
81
|
+
dynamicColumns: dynamicColumns,
|
|
82
|
+
isDynamicTable: isDynamicTable
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
var _default = exports["default"] = useDynamicColumns;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useEditingState = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
/**
|
|
9
|
+
* Hook to manage editing state for table rows
|
|
10
|
+
*/
|
|
11
|
+
var useEditingState = exports.useEditingState = function useEditingState() {
|
|
12
|
+
var _useState = (0, _react.useState)(null),
|
|
13
|
+
editingRowId = _useState[0],
|
|
14
|
+
setEditingRowId = _useState[1];
|
|
15
|
+
var _useState2 = (0, _react.useState)(false),
|
|
16
|
+
isAddingNewRow = _useState2[0],
|
|
17
|
+
setIsAddingNewRow = _useState2[1];
|
|
18
|
+
var _useState3 = (0, _react.useState)(0),
|
|
19
|
+
sessionKey = _useState3[0],
|
|
20
|
+
setSessionKey = _useState3[1];
|
|
21
|
+
var editingRowDataRef = (0, _react.useRef)({});
|
|
22
|
+
var newRowDataRef = (0, _react.useRef)({});
|
|
23
|
+
var incrementSessionKey = (0, _react.useCallback)(function () {
|
|
24
|
+
setSessionKey(function (prev) {
|
|
25
|
+
return prev + 1;
|
|
26
|
+
});
|
|
27
|
+
}, []);
|
|
28
|
+
var resetEditingData = (0, _react.useCallback)(function () {
|
|
29
|
+
editingRowDataRef.current = {};
|
|
30
|
+
newRowDataRef.current = {};
|
|
31
|
+
}, []);
|
|
32
|
+
var isRowEditing = (0, _react.useCallback)(function (rowId) {
|
|
33
|
+
return editingRowId === rowId;
|
|
34
|
+
}, [editingRowId]);
|
|
35
|
+
return {
|
|
36
|
+
editingRowId: editingRowId,
|
|
37
|
+
isAddingNewRow: isAddingNewRow,
|
|
38
|
+
sessionKey: sessionKey,
|
|
39
|
+
editingRowDataRef: editingRowDataRef,
|
|
40
|
+
newRowDataRef: newRowDataRef,
|
|
41
|
+
setEditingRowId: setEditingRowId,
|
|
42
|
+
setIsAddingNewRow: setIsAddingNewRow,
|
|
43
|
+
incrementSessionKey: incrementSessionKey,
|
|
44
|
+
resetEditingData: resetEditingData,
|
|
45
|
+
isRowEditing: isRowEditing
|
|
46
|
+
};
|
|
47
|
+
};
|
|
@@ -0,0 +1,184 @@
|
|
|
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.useFormWidget = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _utils = require("../utils");
|
|
12
|
+
var _text = _interopRequireDefault(require("../../../input/text"));
|
|
13
|
+
var _textarea = _interopRequireDefault(require("../../../input/textarea"));
|
|
14
|
+
var _number = _interopRequireDefault(require("../../../input/number"));
|
|
15
|
+
var _currency = _interopRequireDefault(require("../../../input/currency"));
|
|
16
|
+
var _datetime = _interopRequireDefault(require("../../../input/epoch/datetime"));
|
|
17
|
+
var _time = _interopRequireDefault(require("../../../input/epoch/time"));
|
|
18
|
+
var _date = _interopRequireDefault(require("../../../input/epoch/date"));
|
|
19
|
+
var _select = _interopRequireDefault(require("../../../input/select"));
|
|
20
|
+
var _slider = _interopRequireDefault(require("../../../input/slider"));
|
|
21
|
+
var _rating = _interopRequireDefault(require("../../../input/rating"));
|
|
22
|
+
var _colorPicker = _interopRequireDefault(require("../../../input/color-picker"));
|
|
23
|
+
var _fileupload = _interopRequireDefault(require("../../../input/fileupload"));
|
|
24
|
+
var _chips = _interopRequireDefault(require("../../../input/chips"));
|
|
25
|
+
var _richtexteditor = _interopRequireDefault(require("../../../basic/richtexteditor"));
|
|
26
|
+
var _search = _interopRequireDefault(require("../../../basic/search"));
|
|
27
|
+
var _checkbox = _interopRequireDefault(require("../../../input/default/checkbox"));
|
|
28
|
+
var _switch = _interopRequireDefault(require("../../../input/default/switch"));
|
|
29
|
+
var _checkboxset = _interopRequireDefault(require("../../../input/default/checkboxset"));
|
|
30
|
+
var _radioset = _interopRequireDefault(require("../../../input/default/radioset"));
|
|
31
|
+
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); }
|
|
32
|
+
var __jsx = _react["default"].createElement; // Import form widgets
|
|
33
|
+
var useFormWidget = exports.useFormWidget = function useFormWidget(_ref) {
|
|
34
|
+
var listener = _ref.listener;
|
|
35
|
+
// Function to render the appropriate form widget based on editWidgetType
|
|
36
|
+
var renderFormWidget = (0, _react.useCallback)(function (fieldName, widgetType, value, fieldChangeCallback, widgetProps) {
|
|
37
|
+
// Use defaultvalue if value is null/undefined and defaultvalue is provided
|
|
38
|
+
var effectiveValue = value !== undefined && value !== null ? value : (widgetProps === null || widgetProps === void 0 ? void 0 : widgetProps.defaultvalue) || "";
|
|
39
|
+
var sessionSuffix = widgetProps !== null && widgetProps !== void 0 && widgetProps.sessionKey ? "_".concat(widgetProps.sessionKey) : "";
|
|
40
|
+
var uniqueName = "edit_".concat(fieldName).concat(sessionSuffix);
|
|
41
|
+
var commonProps = {
|
|
42
|
+
key: uniqueName,
|
|
43
|
+
// Add key to force component recreation
|
|
44
|
+
name: uniqueName,
|
|
45
|
+
datavalue: effectiveValue,
|
|
46
|
+
required: (widgetProps === null || widgetProps === void 0 ? void 0 : widgetProps.required) || false,
|
|
47
|
+
disabled: (widgetProps === null || widgetProps === void 0 ? void 0 : widgetProps.disabled) || false,
|
|
48
|
+
placeholder: (widgetProps === null || widgetProps === void 0 ? void 0 : widgetProps.placeholder) || "Enter ".concat(fieldName),
|
|
49
|
+
onChange: function onChange(event, widget, newVal) {
|
|
50
|
+
var _widgetProps$column;
|
|
51
|
+
if (fieldChangeCallback) {
|
|
52
|
+
fieldChangeCallback(newVal);
|
|
53
|
+
}
|
|
54
|
+
// Call the custom onChange handler from column if provided
|
|
55
|
+
if (widgetProps !== null && widgetProps !== void 0 && (_widgetProps$column = widgetProps.column) !== null && _widgetProps$column !== void 0 && _widgetProps$column.onChange) {
|
|
56
|
+
widgetProps.column.onChange(event, {}, widgetProps === null || widgetProps === void 0 ? void 0 : widgetProps.rowData);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
listener: listener,
|
|
60
|
+
rowData: widgetProps === null || widgetProps === void 0 ? void 0 : widgetProps.rowData,
|
|
61
|
+
column: widgetProps === null || widgetProps === void 0 ? void 0 : widgetProps.column
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// Helper function to wrap event handlers with the correct parameters
|
|
65
|
+
var wrapEventHandler = function wrapEventHandler(handler) {
|
|
66
|
+
return function (event) {
|
|
67
|
+
// Pass event, widget (empty for now), and rowData
|
|
68
|
+
handler(event, {}, widgetProps === null || widgetProps === void 0 ? void 0 : widgetProps.rowData);
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// Extract event handlers from column if they exist and wrap them
|
|
73
|
+
var column = widgetProps === null || widgetProps === void 0 ? void 0 : widgetProps.column;
|
|
74
|
+
if (column) {
|
|
75
|
+
if (column.onClick) {
|
|
76
|
+
commonProps.onClick = wrapEventHandler(column.onClick);
|
|
77
|
+
}
|
|
78
|
+
if (column.onFocus) {
|
|
79
|
+
commonProps.onFocus = wrapEventHandler(column.onFocus);
|
|
80
|
+
}
|
|
81
|
+
if (column.onBlur) {
|
|
82
|
+
commonProps.onBlur = wrapEventHandler(column.onBlur);
|
|
83
|
+
}
|
|
84
|
+
if (column.onKeypress) {
|
|
85
|
+
commonProps.onKeypress = wrapEventHandler(column.onKeypress);
|
|
86
|
+
}
|
|
87
|
+
if (column.onKeydown) {
|
|
88
|
+
commonProps.onKeydown = wrapEventHandler(column.onKeydown);
|
|
89
|
+
}
|
|
90
|
+
if (column.onKeyup) {
|
|
91
|
+
commonProps.onKeyup = wrapEventHandler(column.onKeyup);
|
|
92
|
+
}
|
|
93
|
+
if (column.onMouseEnter) {
|
|
94
|
+
commonProps.onMouseEnter = wrapEventHandler(column.onMouseEnter);
|
|
95
|
+
}
|
|
96
|
+
if (column.onMouseLeave) {
|
|
97
|
+
commonProps.onMouseLeave = wrapEventHandler(column.onMouseLeave);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
var mappedWidgetType = (0, _utils.getWidgetMappingForType)(widgetType);
|
|
101
|
+
|
|
102
|
+
// Widget mapping with proper components
|
|
103
|
+
switch (mappedWidgetType) {
|
|
104
|
+
case "WmText":
|
|
105
|
+
// Check if column has editinputtype property
|
|
106
|
+
var editInputType = (column === null || column === void 0 ? void 0 : column.editinputtype) || "text";
|
|
107
|
+
return __jsx(_text["default"], (0, _extends2["default"])({}, commonProps, {
|
|
108
|
+
type: editInputType,
|
|
109
|
+
updateon: "keypress"
|
|
110
|
+
}));
|
|
111
|
+
case "WmPassword":
|
|
112
|
+
return __jsx(_text["default"], (0, _extends2["default"])({}, commonProps, {
|
|
113
|
+
type: "password",
|
|
114
|
+
updateon: "keypress"
|
|
115
|
+
}));
|
|
116
|
+
case "WmTextarea":
|
|
117
|
+
return __jsx(_textarea["default"], (0, _extends2["default"])({}, commonProps, {
|
|
118
|
+
updateon: "keypress"
|
|
119
|
+
}));
|
|
120
|
+
case "WmCheckbox":
|
|
121
|
+
var checkboxDataset = (0, _utils.getBooleanDataset)();
|
|
122
|
+
return __jsx(_checkbox["default"], (0, _extends2["default"])({}, commonProps, {
|
|
123
|
+
dataset: checkboxDataset
|
|
124
|
+
}));
|
|
125
|
+
case "WmToggle":
|
|
126
|
+
case "WmSwitch":
|
|
127
|
+
var switchDataset = (0, _utils.getBooleanDataset)();
|
|
128
|
+
return __jsx(_switch["default"], (0, _extends2["default"])({}, commonProps, {
|
|
129
|
+
dataset: switchDataset
|
|
130
|
+
}));
|
|
131
|
+
case "WmNumber":
|
|
132
|
+
return __jsx(_number["default"], commonProps);
|
|
133
|
+
case "WmCurrency":
|
|
134
|
+
return __jsx(_currency["default"], commonProps);
|
|
135
|
+
case "WmSlider":
|
|
136
|
+
return __jsx(_slider["default"], commonProps);
|
|
137
|
+
case "WmRichtext":
|
|
138
|
+
case "WmRichtexteditor":
|
|
139
|
+
return __jsx(_richtexteditor["default"], commonProps);
|
|
140
|
+
case "WmSelect":
|
|
141
|
+
return __jsx(_select["default"], (0, _extends2["default"])({}, commonProps, {
|
|
142
|
+
dataset: []
|
|
143
|
+
}));
|
|
144
|
+
case "WmCheckboxset":
|
|
145
|
+
return __jsx(_checkboxset["default"], (0, _extends2["default"])({}, commonProps, {
|
|
146
|
+
dataset: []
|
|
147
|
+
}));
|
|
148
|
+
case "WmRadioset":
|
|
149
|
+
return __jsx(_radioset["default"], (0, _extends2["default"])({}, commonProps, {
|
|
150
|
+
dataset: []
|
|
151
|
+
}));
|
|
152
|
+
case "WmDate":
|
|
153
|
+
return __jsx(_date["default"], commonProps);
|
|
154
|
+
case "WmTime":
|
|
155
|
+
return __jsx(_time["default"], commonProps);
|
|
156
|
+
case "WmTimestamp":
|
|
157
|
+
case "WmDatetime":
|
|
158
|
+
case "WmDateTime":
|
|
159
|
+
return __jsx(_datetime["default"], commonProps);
|
|
160
|
+
case "WmRating":
|
|
161
|
+
return __jsx(_rating["default"], commonProps);
|
|
162
|
+
case "WmAutocomplete":
|
|
163
|
+
return __jsx(_search["default"], (0, _extends2["default"])({}, commonProps, {
|
|
164
|
+
dataset: []
|
|
165
|
+
}));
|
|
166
|
+
case "WmChips":
|
|
167
|
+
return __jsx(_chips["default"], (0, _extends2["default"])({}, commonProps, {
|
|
168
|
+
dataset: []
|
|
169
|
+
}));
|
|
170
|
+
case "WmColorpicker":
|
|
171
|
+
case "WmColorPicker":
|
|
172
|
+
return __jsx(_colorPicker["default"], commonProps);
|
|
173
|
+
case "WmFileupload":
|
|
174
|
+
return __jsx(_fileupload["default"], commonProps);
|
|
175
|
+
default:
|
|
176
|
+
// Unknown widget types fallback to text input
|
|
177
|
+
console.warn("Unknown widget type: ".concat(widgetType, ", falling back to WmText"));
|
|
178
|
+
return __jsx(_text["default"], commonProps);
|
|
179
|
+
}
|
|
180
|
+
}, []);
|
|
181
|
+
return {
|
|
182
|
+
renderFormWidget: renderFormWidget
|
|
183
|
+
};
|
|
184
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.usePaginationState = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
/**
|
|
9
|
+
* Hook to manage pagination state and behavior
|
|
10
|
+
*/
|
|
11
|
+
var usePaginationState = exports.usePaginationState = function usePaginationState(_ref) {
|
|
12
|
+
var table = _ref.table,
|
|
13
|
+
editmode = _ref.editmode,
|
|
14
|
+
internalDataset = _ref.internalDataset,
|
|
15
|
+
isAddingNewRow = _ref.isAddingNewRow,
|
|
16
|
+
cancelEditing = _ref.cancelEditing,
|
|
17
|
+
datasource = _ref.datasource,
|
|
18
|
+
isServerSidePagination = _ref.isServerSidePagination;
|
|
19
|
+
var prevPageRef = (0, _react.useRef)(table.getState().pagination.pageIndex);
|
|
20
|
+
|
|
21
|
+
// Hide add new row when page changes
|
|
22
|
+
(0, _react.useEffect)(function () {
|
|
23
|
+
var currentPage = table.getState().pagination.pageIndex;
|
|
24
|
+
if (currentPage !== prevPageRef.current && isAddingNewRow) {
|
|
25
|
+
cancelEditing();
|
|
26
|
+
}
|
|
27
|
+
prevPageRef.current = currentPage;
|
|
28
|
+
}, [table, isAddingNewRow, cancelEditing]);
|
|
29
|
+
var handlePaginationChange = (0, _react.useCallback)(function (event, widget, index) {
|
|
30
|
+
if (editmode === "quickedit" && !isServerSidePagination) {
|
|
31
|
+
var newPageIndex = index - 1; // Convert to 0-based index
|
|
32
|
+
var pageSize = table.getState().pagination.pageSize;
|
|
33
|
+
var dataLength = internalDataset.length;
|
|
34
|
+
var startIdx = newPageIndex * pageSize;
|
|
35
|
+
|
|
36
|
+
// If this would be an empty page (no data on it), prevent navigation
|
|
37
|
+
if (startIdx >= dataLength && dataLength > 0) {
|
|
38
|
+
// Calculate the correct page to navigate to
|
|
39
|
+
var correctPage = Math.ceil(dataLength / pageSize);
|
|
40
|
+
if (correctPage > 0) {
|
|
41
|
+
table.setPageIndex(correctPage - 1); // Convert to 0-based index
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
table.setPageIndex(index - 1);
|
|
47
|
+
}, [editmode, internalDataset, table, isServerSidePagination]);
|
|
48
|
+
var handlePageSizeChange = (0, _react.useCallback)(function (newPageSize) {
|
|
49
|
+
// Update datasource maxResults if datasource has paging capability
|
|
50
|
+
if (isServerSidePagination && datasource && datasource.maxResults !== undefined) {
|
|
51
|
+
datasource.maxResults = newPageSize;
|
|
52
|
+
}
|
|
53
|
+
table.setPageSize(newPageSize);
|
|
54
|
+
table.setPageIndex(0); // Reset to first page
|
|
55
|
+
}, [table, isServerSidePagination, datasource]);
|
|
56
|
+
return {
|
|
57
|
+
handlePaginationChange: handlePaginationChange,
|
|
58
|
+
handlePageSizeChange: handlePageSizeChange
|
|
59
|
+
};
|
|
60
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.usePanelStructure = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _utils = require("../utils");
|
|
9
|
+
var usePanelStructure = exports.usePanelStructure = function usePanelStructure(_ref) {
|
|
10
|
+
var title = _ref.title,
|
|
11
|
+
subheading = _ref.subheading,
|
|
12
|
+
iconclass = _ref.iconclass,
|
|
13
|
+
_ref$exportOptions = _ref.exportOptions,
|
|
14
|
+
exportOptions = _ref$exportOptions === void 0 ? [] : _ref$exportOptions,
|
|
15
|
+
headerActions = _ref.headerActions,
|
|
16
|
+
footerActions = _ref.footerActions,
|
|
17
|
+
shownavigation = _ref.shownavigation,
|
|
18
|
+
onDemandLoad = _ref.onDemandLoad,
|
|
19
|
+
internalDataset = _ref.internalDataset,
|
|
20
|
+
pagesize = _ref.pagesize,
|
|
21
|
+
allowpagesizechange = _ref.allowpagesizechange,
|
|
22
|
+
datasource = _ref.datasource;
|
|
23
|
+
var showPanelHeading = (0, _react.useMemo)(function () {
|
|
24
|
+
return (0, _utils.shouldShowPanelHeading)(title, subheading, iconclass, exportOptions, headerActions);
|
|
25
|
+
}, [title, subheading, iconclass, exportOptions, headerActions]);
|
|
26
|
+
var showPagination = (0, _react.useMemo)(function () {
|
|
27
|
+
return (0, _utils.shouldShowPagination)({
|
|
28
|
+
shownavigation: shownavigation,
|
|
29
|
+
onDemandLoad: onDemandLoad,
|
|
30
|
+
internalDataset: internalDataset,
|
|
31
|
+
pagesize: pagesize,
|
|
32
|
+
allowpagesizechange: allowpagesizechange,
|
|
33
|
+
datasource: datasource
|
|
34
|
+
});
|
|
35
|
+
}, [shownavigation, onDemandLoad, internalDataset, pagesize, allowpagesizechange, datasource]);
|
|
36
|
+
return {
|
|
37
|
+
showPanelHeading: showPanelHeading,
|
|
38
|
+
showPagination: showPagination
|
|
39
|
+
};
|
|
40
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useResponsiveColumns = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _utils = require("../utils");
|
|
9
|
+
var useResponsiveColumns = exports.useResponsiveColumns = function useResponsiveColumns(columns) {
|
|
10
|
+
// Get viewport width once at initialization
|
|
11
|
+
var viewportWidth = (0, _react.useMemo)(function () {
|
|
12
|
+
if (typeof window !== "undefined") {
|
|
13
|
+
return window.innerWidth;
|
|
14
|
+
}
|
|
15
|
+
return 1024; // Default desktop width for SSR
|
|
16
|
+
}, []); // Empty dependency array - only calculated once
|
|
17
|
+
|
|
18
|
+
// Filter columns based on initial viewport
|
|
19
|
+
var visibleColumns = (0, _react.useMemo)(function () {
|
|
20
|
+
if (!columns || !Array.isArray(columns)) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
return columns.filter(function (column) {
|
|
25
|
+
if (!column) return false;
|
|
26
|
+
return (0, _utils.isColumnVisibleForViewport)(column, viewportWidth);
|
|
27
|
+
});
|
|
28
|
+
} catch (error) {
|
|
29
|
+
console.error("Error filtering columns:", error);
|
|
30
|
+
return columns; // Return all columns if filtering fails
|
|
31
|
+
}
|
|
32
|
+
}, [columns, viewportWidth]);
|
|
33
|
+
return visibleColumns;
|
|
34
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useRowExpansion = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _utils = require("../utils");
|
|
9
|
+
/**
|
|
10
|
+
* Hook to manage row expansion state
|
|
11
|
+
*/
|
|
12
|
+
var useRowExpansion = exports.useRowExpansion = function useRowExpansion(_ref) {
|
|
13
|
+
var rowExpansionConfig = _ref.rowExpansionConfig,
|
|
14
|
+
internalDataset = _ref.internalDataset;
|
|
15
|
+
var _useState = (0, _react.useState)(new Set()),
|
|
16
|
+
expandedRows = _useState[0],
|
|
17
|
+
setExpandedRows = _useState[1];
|
|
18
|
+
var expandedRowsRef = (0, _react.useRef)(expandedRows);
|
|
19
|
+
|
|
20
|
+
// Keep ref in sync with state
|
|
21
|
+
(0, _react.useEffect)(function () {
|
|
22
|
+
expandedRowsRef.current = expandedRows;
|
|
23
|
+
}, [expandedRows]);
|
|
24
|
+
var toggleRowExpansion = (0, _react.useCallback)(function (rowId, rowData) {
|
|
25
|
+
if (!rowExpansionConfig || !rowExpansionConfig.show) return;
|
|
26
|
+
var isCurrentlyExpanded = expandedRowsRef.current.has(rowId);
|
|
27
|
+
|
|
28
|
+
// Handle before expand/collapse events
|
|
29
|
+
if (!isCurrentlyExpanded) {
|
|
30
|
+
// Before expand event
|
|
31
|
+
if (rowExpansionConfig.onBeforerowexpand) {
|
|
32
|
+
var _rowExpansionConfig$o;
|
|
33
|
+
var defaultPrevented = false;
|
|
34
|
+
var event = {
|
|
35
|
+
preventDefault: function preventDefault() {
|
|
36
|
+
defaultPrevented = true;
|
|
37
|
+
},
|
|
38
|
+
get defaultPrevented() {
|
|
39
|
+
return defaultPrevented;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
(_rowExpansionConfig$o = rowExpansionConfig.onBeforerowexpand) === null || _rowExpansionConfig$o === void 0 || _rowExpansionConfig$o.call(rowExpansionConfig, event, {}, (0, _utils.cleanRowData)(rowData), (0, _utils.cleanRowData)(internalDataset));
|
|
43
|
+
if (defaultPrevented) return;
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
// Before collapse event
|
|
47
|
+
if (rowExpansionConfig.onBeforerowcollapse) {
|
|
48
|
+
var _rowExpansionConfig$o2;
|
|
49
|
+
var _defaultPrevented = false;
|
|
50
|
+
var _event = {
|
|
51
|
+
preventDefault: function preventDefault() {
|
|
52
|
+
_defaultPrevented = true;
|
|
53
|
+
},
|
|
54
|
+
get defaultPrevented() {
|
|
55
|
+
return _defaultPrevented;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
(_rowExpansionConfig$o2 = rowExpansionConfig.onBeforerowcollapse) === null || _rowExpansionConfig$o2 === void 0 || _rowExpansionConfig$o2.call(rowExpansionConfig, _event, {}, (0, _utils.cleanRowData)(rowData), (0, _utils.cleanRowData)(internalDataset));
|
|
59
|
+
if (_defaultPrevented) return;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
setExpandedRows(function (prev) {
|
|
63
|
+
var newExpandedRows = new Set(prev);
|
|
64
|
+
if (isCurrentlyExpanded) {
|
|
65
|
+
// Collapse the row
|
|
66
|
+
newExpandedRows["delete"](rowId);
|
|
67
|
+
|
|
68
|
+
// Fire collapse event
|
|
69
|
+
if (rowExpansionConfig.onRowcollapse) {
|
|
70
|
+
setTimeout(function () {
|
|
71
|
+
var _rowExpansionConfig$o3;
|
|
72
|
+
(_rowExpansionConfig$o3 = rowExpansionConfig.onRowcollapse) === null || _rowExpansionConfig$o3 === void 0 || _rowExpansionConfig$o3.call(rowExpansionConfig, {}, {}, (0, _utils.cleanRowData)(rowData));
|
|
73
|
+
}, 0);
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
// If closeothers is true, clear all other expanded rows
|
|
77
|
+
if (rowExpansionConfig.closeothers) {
|
|
78
|
+
newExpandedRows.clear();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Expand the row
|
|
82
|
+
newExpandedRows.add(rowId);
|
|
83
|
+
|
|
84
|
+
// Fire expand event
|
|
85
|
+
if (rowExpansionConfig.onRowexpand) {
|
|
86
|
+
setTimeout(function () {
|
|
87
|
+
var _rowExpansionConfig$o4;
|
|
88
|
+
(_rowExpansionConfig$o4 = rowExpansionConfig.onRowexpand) === null || _rowExpansionConfig$o4 === void 0 || _rowExpansionConfig$o4.call(rowExpansionConfig, {}, {
|
|
89
|
+
rowExpansionConfig: rowExpansionConfig
|
|
90
|
+
}, (0, _utils.cleanRowData)(rowData), (0, _utils.cleanRowData)(internalDataset));
|
|
91
|
+
}, 0);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return newExpandedRows;
|
|
95
|
+
});
|
|
96
|
+
}, [rowExpansionConfig, internalDataset]);
|
|
97
|
+
var isRowExpanded = (0, _react.useCallback)(function (rowId) {
|
|
98
|
+
return expandedRows.has(rowId);
|
|
99
|
+
}, [expandedRows]);
|
|
100
|
+
var collapseAllRows = (0, _react.useCallback)(function () {
|
|
101
|
+
setExpandedRows(new Set());
|
|
102
|
+
}, []);
|
|
103
|
+
return {
|
|
104
|
+
expandedRows: expandedRows,
|
|
105
|
+
toggleRowExpansion: toggleRowExpansion,
|
|
106
|
+
isRowExpanded: isRowExpanded,
|
|
107
|
+
collapseAllRows: collapseAllRows,
|
|
108
|
+
rowExpansionConfig: rowExpansionConfig
|
|
109
|
+
};
|
|
110
|
+
};
|