@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,74 @@
|
|
|
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.RowExpansionButton = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _button = _interopRequireDefault(require("../../../form/button"));
|
|
11
|
+
var _anchor = _interopRequireDefault(require("../../../basic/anchor"));
|
|
12
|
+
var __jsx = _react["default"].createElement;
|
|
13
|
+
var RowExpansionButton = exports.RowExpansionButton = function RowExpansionButton(_ref) {
|
|
14
|
+
var rowId = _ref.rowId,
|
|
15
|
+
rowData = _ref.rowData,
|
|
16
|
+
isExpanded = _ref.isExpanded,
|
|
17
|
+
onToggle = _ref.onToggle,
|
|
18
|
+
config = _ref.config;
|
|
19
|
+
if (!config.show) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
var handleClick = function handleClick(event, widget) {
|
|
23
|
+
if (event) {
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
event.stopPropagation();
|
|
26
|
+
}
|
|
27
|
+
if (!config.disabled) {
|
|
28
|
+
onToggle(rowId, rowData);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// Use the appropriate icon based on expanded state
|
|
33
|
+
var currentIcon = isExpanded ? config.expandicon : config.collapseicon;
|
|
34
|
+
var currentTitle = isExpanded ? config.collapsetitle : config.expandtitle;
|
|
35
|
+
var ariaLabel = config.expandtitle || config["displayName"] || "Toggle row expansion";
|
|
36
|
+
|
|
37
|
+
// Build common props with only defined values
|
|
38
|
+
var commonProps = {
|
|
39
|
+
name: "".concat(config.name || "row_expansion", "_").concat(rowId),
|
|
40
|
+
onClick: handleClick,
|
|
41
|
+
iconclass: currentIcon,
|
|
42
|
+
"aria-label": ariaLabel,
|
|
43
|
+
"aria-expanded": isExpanded,
|
|
44
|
+
"aria-live": "polite",
|
|
45
|
+
tabIndex: 0
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// Only add optional props if they have values
|
|
49
|
+
if (config.listener) {
|
|
50
|
+
commonProps.listener = config.listener;
|
|
51
|
+
}
|
|
52
|
+
if (config["displayName"]) {
|
|
53
|
+
commonProps.caption = config["displayName"];
|
|
54
|
+
}
|
|
55
|
+
if (currentTitle) {
|
|
56
|
+
commonProps.title = currentTitle;
|
|
57
|
+
}
|
|
58
|
+
if (config.className) {
|
|
59
|
+
commonProps.className = "".concat(config.className, " row-expansion-button");
|
|
60
|
+
}
|
|
61
|
+
if (config.disabled) {
|
|
62
|
+
commonProps.disabled = config.disabled;
|
|
63
|
+
}
|
|
64
|
+
if (config.widgetType === "anchor") {
|
|
65
|
+
return __jsx(_anchor["default"], (0, _extends2["default"])({}, commonProps, {
|
|
66
|
+
hyperlink: "#",
|
|
67
|
+
role: "button"
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
return __jsx(_button["default"], (0, _extends2["default"])({}, commonProps, {
|
|
71
|
+
type: "button"
|
|
72
|
+
}));
|
|
73
|
+
};
|
|
74
|
+
var _default = exports["default"] = RowExpansionButton;
|
|
@@ -0,0 +1,279 @@
|
|
|
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.TableBodyComponent = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _material = require("@mui/material");
|
|
13
|
+
var _reactTable = require("@tanstack/react-table");
|
|
14
|
+
var _utils = require("../utils");
|
|
15
|
+
var _RowExpansionButton = require("./RowExpansionButton");
|
|
16
|
+
var _excluded = ["name", "content"],
|
|
17
|
+
_excluded2 = ["className", "textAlign", "backgroundColor"];
|
|
18
|
+
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); }
|
|
19
|
+
var __jsx = _react["default"].createElement;
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
// Constants
|
|
23
|
+
var SYSTEM_COLUMN_IDS = ["multiSelect", "radioSelect", "row-index", "actions"];
|
|
24
|
+
var DEFAULT_EXPANSION_WIDTH = "50px";
|
|
25
|
+
var EXPANDED_ROW_BG_COLOR = "#f5f5f5";
|
|
26
|
+
var DEFAULT_CELL_PADDING = "2rem";
|
|
27
|
+
|
|
28
|
+
// Helper functions
|
|
29
|
+
var isSystemColumn = function isSystemColumn(columnId) {
|
|
30
|
+
return SYSTEM_COLUMN_IDS.includes(columnId);
|
|
31
|
+
};
|
|
32
|
+
var parsePosition = function parsePosition(position) {
|
|
33
|
+
if (!position) return 0;
|
|
34
|
+
if (position === "-1" || position === -1) return -1;
|
|
35
|
+
return typeof position === "number" ? position : Number(position);
|
|
36
|
+
};
|
|
37
|
+
var EmptyRow = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
38
|
+
var colSpan = _ref.colSpan,
|
|
39
|
+
message = _ref.message,
|
|
40
|
+
_ref$rowClass = _ref.rowClass,
|
|
41
|
+
rowClass = _ref$rowClass === void 0 ? "" : _ref$rowClass;
|
|
42
|
+
return __jsx(_material.TableRow, {
|
|
43
|
+
className: rowClass
|
|
44
|
+
}, __jsx(_material.TableCell, {
|
|
45
|
+
colSpan: colSpan,
|
|
46
|
+
className: "".concat(_utils.TABLE_CSS_CLASSES.tableCell, " text-center"),
|
|
47
|
+
style: {
|
|
48
|
+
padding: DEFAULT_CELL_PADDING
|
|
49
|
+
}
|
|
50
|
+
}, message));
|
|
51
|
+
});
|
|
52
|
+
EmptyRow.displayName = "EmptyRow";
|
|
53
|
+
var ExpansionCell = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
|
|
54
|
+
var rowId = _ref2.rowId,
|
|
55
|
+
rowData = _ref2.rowData,
|
|
56
|
+
isExpanded = _ref2.isExpanded,
|
|
57
|
+
onToggle = _ref2.onToggle,
|
|
58
|
+
config = _ref2.config;
|
|
59
|
+
return __jsx(_material.TableCell, {
|
|
60
|
+
className: "app-datagrid-cell row-expansion-cell",
|
|
61
|
+
style: {
|
|
62
|
+
textAlign: "center",
|
|
63
|
+
position: "relative",
|
|
64
|
+
width: config.columnwidth || DEFAULT_EXPANSION_WIDTH,
|
|
65
|
+
padding: "4px"
|
|
66
|
+
}
|
|
67
|
+
}, __jsx(_material.Box, {
|
|
68
|
+
component: "span",
|
|
69
|
+
className: "row-expansion-column",
|
|
70
|
+
"data-identifier": "rowExpansionButtons"
|
|
71
|
+
}, __jsx(_RowExpansionButton.RowExpansionButton, {
|
|
72
|
+
rowId: rowId,
|
|
73
|
+
rowData: rowData,
|
|
74
|
+
isExpanded: isExpanded,
|
|
75
|
+
onToggle: onToggle,
|
|
76
|
+
config: config
|
|
77
|
+
})));
|
|
78
|
+
});
|
|
79
|
+
ExpansionCell.displayName = "ExpansionCell";
|
|
80
|
+
var ExpandedContent = /*#__PURE__*/(0, _react.memo)(function (_ref3) {
|
|
81
|
+
var rowId = _ref3.rowId,
|
|
82
|
+
rowData = _ref3.rowData,
|
|
83
|
+
config = _ref3.config,
|
|
84
|
+
colSpan = _ref3.colSpan;
|
|
85
|
+
var renderContent = (0, _react.useCallback)(function () {
|
|
86
|
+
if (config.renderPartial) {
|
|
87
|
+
var name = config.name,
|
|
88
|
+
content = config.content,
|
|
89
|
+
restConfig = (0, _objectWithoutProperties2["default"])(config, _excluded);
|
|
90
|
+
var partialProps = _objectSpread({
|
|
91
|
+
name: name || "table_row",
|
|
92
|
+
content: content,
|
|
93
|
+
rowData: rowData,
|
|
94
|
+
rowId: rowId
|
|
95
|
+
}, restConfig);
|
|
96
|
+
var onLoad = function onLoad() {
|
|
97
|
+
console.log("Partial content loaded for row:", rowId);
|
|
98
|
+
};
|
|
99
|
+
return config.renderPartial(partialProps, onLoad);
|
|
100
|
+
}
|
|
101
|
+
if (config.children) {
|
|
102
|
+
return config.children;
|
|
103
|
+
}
|
|
104
|
+
return __jsx("div", null, config.content || "No content available");
|
|
105
|
+
}, [config, rowData, rowId]);
|
|
106
|
+
return __jsx(_material.TableRow, {
|
|
107
|
+
className: "expanded-row-content",
|
|
108
|
+
"data-row-id": rowId,
|
|
109
|
+
style: {
|
|
110
|
+
backgroundColor: EXPANDED_ROW_BG_COLOR
|
|
111
|
+
}
|
|
112
|
+
}, __jsx(_material.TableCell, {
|
|
113
|
+
colSpan: colSpan,
|
|
114
|
+
style: {
|
|
115
|
+
padding: "16px",
|
|
116
|
+
borderBottom: "1px solid #e0e0e0"
|
|
117
|
+
}
|
|
118
|
+
}, renderContent()));
|
|
119
|
+
});
|
|
120
|
+
ExpandedContent.displayName = "ExpandedContent";
|
|
121
|
+
|
|
122
|
+
// Custom hook for expansion logic
|
|
123
|
+
var useExpansionPosition = function useExpansionPosition(hasExpansion, rowExpansionConfig, columns) {
|
|
124
|
+
return (0, _react.useMemo)(function () {
|
|
125
|
+
if (!hasExpansion || !rowExpansionConfig) return -1;
|
|
126
|
+
var position = rowExpansionConfig.position;
|
|
127
|
+
var parsedPosition = parsePosition(position);
|
|
128
|
+
|
|
129
|
+
// Insert before last column
|
|
130
|
+
if (parsedPosition === -1) {
|
|
131
|
+
return columns.length - 1;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Position is a number - calculate based on data columns
|
|
135
|
+
if (!isNaN(parsedPosition)) {
|
|
136
|
+
var firstDataColumnIndex = columns.findIndex(function (col) {
|
|
137
|
+
return !isSystemColumn(col.id);
|
|
138
|
+
});
|
|
139
|
+
return Math.max(0, firstDataColumnIndex + parsedPosition);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Position is a column name
|
|
143
|
+
if (typeof position === "string") {
|
|
144
|
+
var columnIndex = columns.findIndex(function (col) {
|
|
145
|
+
// Check direct match with id or accessorKey
|
|
146
|
+
if (col.id === position || col.accessorKey === position) {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
// For nested paths like "name.location.url", TanStack converts dots to underscores in id
|
|
150
|
+
var normalizedPosition = position.replace(/\./g, "_");
|
|
151
|
+
return col.id === normalizedPosition;
|
|
152
|
+
});
|
|
153
|
+
// Return index + 1 to place AFTER the named column
|
|
154
|
+
return columnIndex >= 0 ? columnIndex + 1 : 0;
|
|
155
|
+
}
|
|
156
|
+
return 0;
|
|
157
|
+
}, [hasExpansion, rowExpansionConfig, columns]);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// Main component
|
|
161
|
+
var TableBodyComponentBase = function TableBodyComponentBase(_ref4) {
|
|
162
|
+
var table = _ref4.table,
|
|
163
|
+
columns = _ref4.columns,
|
|
164
|
+
_ref4$rowClass = _ref4.rowClass,
|
|
165
|
+
rowClass = _ref4$rowClass === void 0 ? "" : _ref4$rowClass,
|
|
166
|
+
_ref4$formposition = _ref4.formposition,
|
|
167
|
+
formposition = _ref4$formposition === void 0 ? "bottom" : _ref4$formposition,
|
|
168
|
+
renderAddNewRow = _ref4.renderAddNewRow,
|
|
169
|
+
onRowClick = _ref4.onRowClick,
|
|
170
|
+
isRowActive = _ref4.isRowActive,
|
|
171
|
+
isRowSelected = _ref4.isRowSelected,
|
|
172
|
+
_ref4$nodatamessage = _ref4.nodatamessage,
|
|
173
|
+
nodatamessage = _ref4$nodatamessage === void 0 ? _utils.TABLE_MESSAGES.noDataMessage : _ref4$nodatamessage,
|
|
174
|
+
_ref4$loadingdatamsg = _ref4.loadingdatamsg,
|
|
175
|
+
loadingdatamsg = _ref4$loadingdatamsg === void 0 ? _utils.TABLE_MESSAGES.loadingMessage : _ref4$loadingdatamsg,
|
|
176
|
+
_ref4$isLoading = _ref4.isLoading,
|
|
177
|
+
isLoading = _ref4$isLoading === void 0 ? false : _ref4$isLoading,
|
|
178
|
+
rowExpansionConfig = _ref4.rowExpansionConfig,
|
|
179
|
+
_ref4$expandedRows = _ref4.expandedRows,
|
|
180
|
+
expandedRows = _ref4$expandedRows === void 0 ? new Set() : _ref4$expandedRows,
|
|
181
|
+
toggleRowExpansion = _ref4.toggleRowExpansion,
|
|
182
|
+
isRowExpanded = _ref4.isRowExpanded;
|
|
183
|
+
var hasExpansion = !!(rowExpansionConfig !== null && rowExpansionConfig !== void 0 && rowExpansionConfig.show && toggleRowExpansion && isRowExpanded);
|
|
184
|
+
var expansionInsertIndex = useExpansionPosition(hasExpansion, rowExpansionConfig || null, columns);
|
|
185
|
+
var totalColumns = columns.length + (hasExpansion ? 1 : 0);
|
|
186
|
+
var renderExpansionCell = (0, _react.useCallback)(function (rowId, rowData) {
|
|
187
|
+
if (!hasExpansion || !rowExpansionConfig) return null;
|
|
188
|
+
return __jsx(ExpansionCell, {
|
|
189
|
+
key: "expansion-".concat(rowId),
|
|
190
|
+
rowId: rowId,
|
|
191
|
+
rowData: rowData,
|
|
192
|
+
isExpanded: isRowExpanded(rowId),
|
|
193
|
+
onToggle: toggleRowExpansion,
|
|
194
|
+
config: rowExpansionConfig
|
|
195
|
+
});
|
|
196
|
+
}, [hasExpansion, rowExpansionConfig, isRowExpanded, toggleRowExpansion]);
|
|
197
|
+
var renderDataRow = (0, _react.useCallback)(function (row) {
|
|
198
|
+
var rowId = row.id;
|
|
199
|
+
var isSelected = isRowSelected(rowId);
|
|
200
|
+
var isActive = isRowActive(rowId, isSelected);
|
|
201
|
+
var rowIsExpanded = (isRowExpanded === null || isRowExpanded === void 0 ? void 0 : isRowExpanded(rowId)) || false;
|
|
202
|
+
return __jsx(_react.Fragment, {
|
|
203
|
+
key: rowId
|
|
204
|
+
}, __jsx(_material.TableRow, {
|
|
205
|
+
className: "".concat(_utils.TABLE_CSS_CLASSES.tableRow, " ").concat(isActive ? "active" : "", " ").concat(rowClass),
|
|
206
|
+
onClick: function onClick(event) {
|
|
207
|
+
return onRowClick(event, row.original, rowId);
|
|
208
|
+
},
|
|
209
|
+
style: {
|
|
210
|
+
cursor: "pointer"
|
|
211
|
+
}
|
|
212
|
+
}, row.getVisibleCells().map(function (cell, cellIndex) {
|
|
213
|
+
var _cell$column$columnDe, _cell$column$columnDe2, _cell$column$columnDe3;
|
|
214
|
+
return __jsx(_react.Fragment, {
|
|
215
|
+
key: "cell-".concat(cellIndex)
|
|
216
|
+
}, hasExpansion && cellIndex === expansionInsertIndex && renderExpansionCell(rowId, row.original), __jsx(_material.TableCell, {
|
|
217
|
+
key: cell.id,
|
|
218
|
+
title: row.getValue(cell.column.id) ? String(row.getValue(cell.column.id)) : "",
|
|
219
|
+
className: "".concat(_utils.TABLE_CSS_CLASSES.tableCell, " ").concat(((_cell$column$columnDe = cell.column.columnDef.meta) === null || _cell$column$columnDe === void 0 ? void 0 : _cell$column$columnDe.className) || "").trim(),
|
|
220
|
+
style: _objectSpread({
|
|
221
|
+
width: cell.column.getSize(),
|
|
222
|
+
textAlign: (_cell$column$columnDe2 = cell.column.columnDef.meta) === null || _cell$column$columnDe2 === void 0 ? void 0 : _cell$column$columnDe2.textAlign,
|
|
223
|
+
backgroundColor: (_cell$column$columnDe3 = cell.column.columnDef.meta) === null || _cell$column$columnDe3 === void 0 ? void 0 : _cell$column$columnDe3.backgroundColor
|
|
224
|
+
}, function () {
|
|
225
|
+
var _ref5 = cell.column.columnDef.meta || {},
|
|
226
|
+
className = _ref5.className,
|
|
227
|
+
textAlign = _ref5.textAlign,
|
|
228
|
+
backgroundColor = _ref5.backgroundColor,
|
|
229
|
+
otherMeta = (0, _objectWithoutProperties2["default"])(_ref5, _excluded2);
|
|
230
|
+
return otherMeta;
|
|
231
|
+
}())
|
|
232
|
+
}, (0, _reactTable.flexRender)(cell.column.columnDef.cell, cell.getContext())));
|
|
233
|
+
})), hasExpansion && rowIsExpanded && rowExpansionConfig && __jsx(ExpandedContent, {
|
|
234
|
+
rowId: rowId,
|
|
235
|
+
rowData: row.original,
|
|
236
|
+
config: rowExpansionConfig,
|
|
237
|
+
colSpan: totalColumns
|
|
238
|
+
}));
|
|
239
|
+
}, [isRowSelected, isRowActive, rowClass, onRowClick, hasExpansion, expansionInsertIndex, renderExpansionCell, isRowExpanded, rowExpansionConfig, totalColumns]);
|
|
240
|
+
|
|
241
|
+
// Render logic
|
|
242
|
+
var renderTableContent = function renderTableContent() {
|
|
243
|
+
var rows = table.getRowModel().rows;
|
|
244
|
+
if (rows.length === 0) {
|
|
245
|
+
return __jsx(EmptyRow, {
|
|
246
|
+
colSpan: totalColumns,
|
|
247
|
+
message: nodatamessage,
|
|
248
|
+
rowClass: rowClass
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
return rows.map(renderDataRow);
|
|
252
|
+
};
|
|
253
|
+
return __jsx(_material.TableBody, {
|
|
254
|
+
className: "app-grid-content ".concat(_utils.TABLE_CSS_CLASSES.gridBody)
|
|
255
|
+
}, formposition === "top" && renderAddNewRow(), renderTableContent(), formposition === "bottom" && renderAddNewRow());
|
|
256
|
+
};
|
|
257
|
+
var TableBodyComponent = exports.TableBodyComponent = /*#__PURE__*/(0, _react.memo)(TableBodyComponentBase, function (prevProps, nextProps) {
|
|
258
|
+
// Since table key forces rebuilds on pagination, we can use simpler memoization
|
|
259
|
+
// Just prevent re-renders from function reference changes
|
|
260
|
+
|
|
261
|
+
// Allow re-render for these critical changes
|
|
262
|
+
if (prevProps.isLoading !== nextProps.isLoading) return false;
|
|
263
|
+
if (prevProps.rowClass !== nextProps.rowClass) return false;
|
|
264
|
+
if (prevProps.formposition !== nextProps.formposition) return false;
|
|
265
|
+
if (prevProps.nodatamessage !== nextProps.nodatamessage) return false;
|
|
266
|
+
|
|
267
|
+
// Check expandedRows
|
|
268
|
+
if (prevProps.expandedRows !== nextProps.expandedRows) {
|
|
269
|
+
var _prevProps$expandedRo, _nextProps$expandedRo;
|
|
270
|
+
var prevSize = ((_prevProps$expandedRo = prevProps.expandedRows) === null || _prevProps$expandedRo === void 0 ? void 0 : _prevProps$expandedRo.size) || 0;
|
|
271
|
+
var nextSize = ((_nextProps$expandedRo = nextProps.expandedRows) === null || _nextProps$expandedRo === void 0 ? void 0 : _nextProps$expandedRo.size) || 0;
|
|
272
|
+
if (prevSize !== nextSize) return false;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// Block re-render only for function reference changes (prevents infinite loops)
|
|
276
|
+
// Table key handles pagination rebuilds, so we don't need complex row comparisons
|
|
277
|
+
return true; // Prevent re-render for function reference changes only
|
|
278
|
+
});
|
|
279
|
+
TableBodyComponent.displayName = "TableBodyComponent";
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.TableFilterRow = exports.GlobalSearchFilter = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
var _lodashEs = require("lodash-es");
|
|
11
|
+
var _utils = require("../../utils");
|
|
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
|
+
var __jsx = _react["default"].createElement;
|
|
14
|
+
var GlobalSearchFilter = exports.GlobalSearchFilter = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
15
|
+
var value = _ref.value,
|
|
16
|
+
onChange = _ref.onChange,
|
|
17
|
+
selectedColumn = _ref.selectedColumn,
|
|
18
|
+
onColumnChange = _ref.onColumnChange,
|
|
19
|
+
columns = _ref.columns,
|
|
20
|
+
_ref$searchLabel = _ref.searchLabel,
|
|
21
|
+
searchLabel = _ref$searchLabel === void 0 ? "Search" : _ref$searchLabel;
|
|
22
|
+
// Local state for input value
|
|
23
|
+
var _useState = (0, _react.useState)(value),
|
|
24
|
+
inputValue = _useState[0],
|
|
25
|
+
setInputValue = _useState[1];
|
|
26
|
+
// Local state for selected column to prevent immediate API calls
|
|
27
|
+
var _useState2 = (0, _react.useState)(selectedColumn),
|
|
28
|
+
localSelectedColumn = _useState2[0],
|
|
29
|
+
setLocalSelectedColumn = _useState2[1];
|
|
30
|
+
|
|
31
|
+
// Update local value when prop changes
|
|
32
|
+
(0, _react.useEffect)(function () {
|
|
33
|
+
setInputValue(value);
|
|
34
|
+
}, [value]);
|
|
35
|
+
|
|
36
|
+
// Update local column when prop changes
|
|
37
|
+
(0, _react.useEffect)(function () {
|
|
38
|
+
setLocalSelectedColumn(selectedColumn);
|
|
39
|
+
}, [selectedColumn]);
|
|
40
|
+
|
|
41
|
+
// Filter out non-data columns for the dropdown using lodash
|
|
42
|
+
var actionColumnIds = ["actions", "row-operations", "multiSelect", "radioSelect", "row-index"];
|
|
43
|
+
var searchableColumns = (0, _lodashEs.filter)(columns || [], function (col) {
|
|
44
|
+
return (col === null || col === void 0 ? void 0 : col.accessorKey) && !(0, _lodashEs.includes)(actionColumnIds, col === null || col === void 0 ? void 0 : col.id);
|
|
45
|
+
});
|
|
46
|
+
var handleSearch = function handleSearch() {
|
|
47
|
+
// Always update the value when search is triggered
|
|
48
|
+
onChange(inputValue);
|
|
49
|
+
|
|
50
|
+
// Update column selection if it changed
|
|
51
|
+
if (localSelectedColumn !== selectedColumn) {
|
|
52
|
+
onColumnChange(localSelectedColumn);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var handleKeyDown = function handleKeyDown(e) {
|
|
56
|
+
if (e.key === "Enter") {
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
handleSearch();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
return __jsx(_material.Box, {
|
|
62
|
+
component: "form",
|
|
63
|
+
className: "form-search form-inline",
|
|
64
|
+
onSubmit: function onSubmit(e) {
|
|
65
|
+
return e.preventDefault();
|
|
66
|
+
}
|
|
67
|
+
}, __jsx(_material.Box, {
|
|
68
|
+
className: "form-group form-group-sm"
|
|
69
|
+
}, __jsx(_material.Input, {
|
|
70
|
+
type: "text",
|
|
71
|
+
className: "form-control app-textbox",
|
|
72
|
+
placeholder: searchLabel,
|
|
73
|
+
value: inputValue,
|
|
74
|
+
onChange: function onChange(e) {
|
|
75
|
+
return setInputValue(e.target.value);
|
|
76
|
+
},
|
|
77
|
+
onKeyDown: handleKeyDown,
|
|
78
|
+
size: "small"
|
|
79
|
+
})), __jsx(_material.Box, {
|
|
80
|
+
className: "input-append input-group input-group-sm",
|
|
81
|
+
component: "div"
|
|
82
|
+
}, __jsx(_material.Box, {
|
|
83
|
+
component: "select",
|
|
84
|
+
name: "wm-datatable",
|
|
85
|
+
"data-element": "dgFilterValue",
|
|
86
|
+
className: "form-control app-select input-sm",
|
|
87
|
+
value: localSelectedColumn,
|
|
88
|
+
onChange: function onChange(e) {
|
|
89
|
+
return setLocalSelectedColumn(e.target.value);
|
|
90
|
+
}
|
|
91
|
+
}, __jsx("option", {
|
|
92
|
+
value: "",
|
|
93
|
+
className: "placeholder"
|
|
94
|
+
}, "Select Field"), (0, _lodashEs.map)(searchableColumns, function (column, index) {
|
|
95
|
+
return __jsx("option", {
|
|
96
|
+
key: column.id || column.accessorKey,
|
|
97
|
+
value: column.accessorKey,
|
|
98
|
+
"data-coldef-index": index
|
|
99
|
+
}, column.header);
|
|
100
|
+
})), __jsx(_material.Box, {
|
|
101
|
+
component: "span",
|
|
102
|
+
className: "input-group-addon"
|
|
103
|
+
}, __jsx(_material.Box, {
|
|
104
|
+
component: "button",
|
|
105
|
+
type: "button",
|
|
106
|
+
"data-element": "dgSearchButton",
|
|
107
|
+
className: "app-search-button",
|
|
108
|
+
title: searchLabel,
|
|
109
|
+
onClick: handleSearch
|
|
110
|
+
}, __jsx(_material.Box, {
|
|
111
|
+
component: "i",
|
|
112
|
+
className: "wi wi-search"
|
|
113
|
+
})))));
|
|
114
|
+
});
|
|
115
|
+
GlobalSearchFilter.displayName = "GlobalSearchFilter";
|
|
116
|
+
// Component to handle individual column filter with local state
|
|
117
|
+
var ColumnFilterCell = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
|
|
118
|
+
var columnId = _ref2.columnId,
|
|
119
|
+
value = _ref2.value,
|
|
120
|
+
onChange = _ref2.onChange,
|
|
121
|
+
widgetType = _ref2.widgetType,
|
|
122
|
+
columnMeta = _ref2.columnMeta,
|
|
123
|
+
columnAccessorKey = _ref2.columnAccessorKey,
|
|
124
|
+
listener = _ref2.listener,
|
|
125
|
+
renderFormWidget = _ref2.renderFormWidget,
|
|
126
|
+
onMatchModeChange = _ref2.onMatchModeChange;
|
|
127
|
+
var _useState3 = (0, _react.useState)(value),
|
|
128
|
+
localValue = _useState3[0],
|
|
129
|
+
setLocalValue = _useState3[1];
|
|
130
|
+
var _useState4 = (0, _react.useState)(null),
|
|
131
|
+
anchorEl = _useState4[0],
|
|
132
|
+
setAnchorEl = _useState4[1];
|
|
133
|
+
var _useState5 = (0, _react.useState)("anywhereignorecase"),
|
|
134
|
+
selectedMatchMode = _useState5[0],
|
|
135
|
+
setSelectedMatchMode = _useState5[1];
|
|
136
|
+
var filterButtonRef = (0, _react.useRef)(null);
|
|
137
|
+
(0, _react.useEffect)(function () {
|
|
138
|
+
setLocalValue(value);
|
|
139
|
+
}, [value]);
|
|
140
|
+
var handleApplyFilter = function handleApplyFilter() {
|
|
141
|
+
// Only trigger onChange if the value has actually changed
|
|
142
|
+
if (localValue !== value) {
|
|
143
|
+
onChange(columnId, localValue, selectedMatchMode);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
var handleKeyDown = function handleKeyDown(e) {
|
|
147
|
+
if (e.key === "Enter") {
|
|
148
|
+
e.preventDefault();
|
|
149
|
+
handleApplyFilter();
|
|
150
|
+
}
|
|
151
|
+
e.stopPropagation(); // Prevent table keyboard shortcuts
|
|
152
|
+
};
|
|
153
|
+
var handleFilterIconClick = function handleFilterIconClick(e) {
|
|
154
|
+
e.stopPropagation();
|
|
155
|
+
setAnchorEl(filterButtonRef.current);
|
|
156
|
+
};
|
|
157
|
+
var handleClosePopover = function handleClosePopover() {
|
|
158
|
+
setAnchorEl(null);
|
|
159
|
+
};
|
|
160
|
+
var handleMatchModeSelect = function handleMatchModeSelect(matchMode) {
|
|
161
|
+
setSelectedMatchMode(matchMode);
|
|
162
|
+
if (onMatchModeChange) {
|
|
163
|
+
onMatchModeChange(columnId, matchMode);
|
|
164
|
+
}
|
|
165
|
+
// Apply the filter with new match mode if there's a value
|
|
166
|
+
if (localValue) {
|
|
167
|
+
onChange(columnId, localValue, matchMode);
|
|
168
|
+
}
|
|
169
|
+
handleClosePopover();
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// Get the data type from widget type
|
|
173
|
+
var getDataTypeFromWidget = function getDataTypeFromWidget(widget) {
|
|
174
|
+
var editType = columnMeta.editinputtype;
|
|
175
|
+
|
|
176
|
+
// Check edit input type first
|
|
177
|
+
if (editType === "number") return "number";
|
|
178
|
+
if (editType === "date" || editType === "datetime-local" || editType === "time") return "date";
|
|
179
|
+
|
|
180
|
+
// Check widget type
|
|
181
|
+
switch (widget) {
|
|
182
|
+
case "number":
|
|
183
|
+
case "currency":
|
|
184
|
+
case "integer":
|
|
185
|
+
return "number";
|
|
186
|
+
case "date":
|
|
187
|
+
case "datetime":
|
|
188
|
+
case "time":
|
|
189
|
+
case "timestamp":
|
|
190
|
+
return "date";
|
|
191
|
+
case "text":
|
|
192
|
+
case "textarea":
|
|
193
|
+
case "string":
|
|
194
|
+
default:
|
|
195
|
+
return "string";
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
// Get available match modes for the column type
|
|
200
|
+
var getMatchModes = function getMatchModes() {
|
|
201
|
+
var dataType = getDataTypeFromWidget(widgetType);
|
|
202
|
+
var matchModeMap = (0, _utils.getMatchModeTypesMap)();
|
|
203
|
+
return matchModeMap[dataType] || matchModeMap["default"] || [];
|
|
204
|
+
};
|
|
205
|
+
var matchModes = getMatchModes();
|
|
206
|
+
var matchModeMessages = (0, _utils.getMatchModeMsgs)(listener === null || listener === void 0 ? void 0 : listener.appLocale);
|
|
207
|
+
|
|
208
|
+
// Get CSS class based on widget type
|
|
209
|
+
var getInputGroupClass = function getInputGroupClass() {
|
|
210
|
+
var dataType = getDataTypeFromWidget(widgetType);
|
|
211
|
+
switch (dataType) {
|
|
212
|
+
case "number":
|
|
213
|
+
return "input-group number input-group-sm";
|
|
214
|
+
case "date":
|
|
215
|
+
return "input-group date input-group-sm";
|
|
216
|
+
default:
|
|
217
|
+
return "input-group text input-group-sm";
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
return __jsx(_material.Box, {
|
|
221
|
+
component: "div",
|
|
222
|
+
"data-col-identifier": columnAccessorKey,
|
|
223
|
+
className: getInputGroupClass()
|
|
224
|
+
}, __jsx(_material.Box, {
|
|
225
|
+
onBlur: handleApplyFilter,
|
|
226
|
+
onKeyDown: handleKeyDown,
|
|
227
|
+
onClick: function onClick(e) {
|
|
228
|
+
return e.stopPropagation();
|
|
229
|
+
}
|
|
230
|
+
}, renderFormWidget(columnId, widgetType, localValue, function (value) {
|
|
231
|
+
return setLocalValue(value);
|
|
232
|
+
}, {
|
|
233
|
+
placeholder: "",
|
|
234
|
+
sessionKey: "filter_".concat(columnId),
|
|
235
|
+
column: columnMeta
|
|
236
|
+
})), __jsx(_material.Box, {
|
|
237
|
+
component: "span",
|
|
238
|
+
className: "input-group-addon"
|
|
239
|
+
}, __jsx(_material.Box, {
|
|
240
|
+
ref: filterButtonRef,
|
|
241
|
+
component: "button",
|
|
242
|
+
type: "button",
|
|
243
|
+
className: "btn-transparent btn app-button",
|
|
244
|
+
"aria-haspopup": "true",
|
|
245
|
+
"aria-expanded": Boolean(anchorEl),
|
|
246
|
+
onClick: handleFilterIconClick
|
|
247
|
+
}, __jsx(_material.Box, {
|
|
248
|
+
component: "i",
|
|
249
|
+
className: "app-icon wi wi-filter-list"
|
|
250
|
+
})), Boolean(anchorEl) && __jsx(_material.ClickAwayListener, {
|
|
251
|
+
onClickAway: handleClosePopover
|
|
252
|
+
}, __jsx(_material.Box, {
|
|
253
|
+
className: "dropdown open show",
|
|
254
|
+
style: {
|
|
255
|
+
position: "absolute",
|
|
256
|
+
top: "100%",
|
|
257
|
+
right: 0,
|
|
258
|
+
zIndex: 1000
|
|
259
|
+
}
|
|
260
|
+
}, __jsx(_material.Box, {
|
|
261
|
+
component: "ul",
|
|
262
|
+
className: "matchmode-dropdown dropdown-menu"
|
|
263
|
+
}, (0, _lodashEs.map)(matchModes, function (mode) {
|
|
264
|
+
return __jsx(_material.Box, {
|
|
265
|
+
key: mode,
|
|
266
|
+
component: "li",
|
|
267
|
+
className: selectedMatchMode === mode ? "active" : ""
|
|
268
|
+
}, __jsx(_material.Box, {
|
|
269
|
+
component: "a",
|
|
270
|
+
onClick: function onClick() {
|
|
271
|
+
return handleMatchModeSelect(mode);
|
|
272
|
+
},
|
|
273
|
+
sx: {
|
|
274
|
+
cursor: "pointer",
|
|
275
|
+
textDecoration: "none"
|
|
276
|
+
}
|
|
277
|
+
}, matchModeMessages[mode] || mode));
|
|
278
|
+
}))))));
|
|
279
|
+
});
|
|
280
|
+
ColumnFilterCell.displayName = "ColumnFilterCell";
|
|
281
|
+
var TableFilterRow = exports.TableFilterRow = /*#__PURE__*/(0, _react.memo)(function (_ref3) {
|
|
282
|
+
var columns = _ref3.columns,
|
|
283
|
+
columnFilters = _ref3.columnFilters,
|
|
284
|
+
onColumnFilterChange = _ref3.onColumnFilterChange,
|
|
285
|
+
filterMode = _ref3.filterMode,
|
|
286
|
+
renderFormWidget = _ref3.renderFormWidget,
|
|
287
|
+
listener = _ref3.listener;
|
|
288
|
+
if (filterMode !== "multicolumn") {
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
return __jsx("tr", {
|
|
292
|
+
className: "table-filter-row"
|
|
293
|
+
}, (0, _lodashEs.map)(columns, function (column, index) {
|
|
294
|
+
var _columnFilters$column;
|
|
295
|
+
// Use accessorKey as the column ID if id is not present
|
|
296
|
+
var columnId = column.id || column.accessorKey;
|
|
297
|
+
|
|
298
|
+
// Skip filter for action columns or columns that are not filterable
|
|
299
|
+
var actionColumnIds = ["actions", "row-operations", "multiSelect", "radioSelect", "row-index"];
|
|
300
|
+
var isActionColumn = (0, _lodashEs.includes)(actionColumnIds, columnId) || column.isRowIndex;
|
|
301
|
+
if (isActionColumn || column.enableColumnFilter === false || !column.accessorKey) {
|
|
302
|
+
return __jsx("th", {
|
|
303
|
+
key: columnId
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Get the original column metadata if available
|
|
308
|
+
var columnMeta = column.meta || {};
|
|
309
|
+
var widgetType = columnMeta.editWidgetType || columnMeta.widgetType || "text";
|
|
310
|
+
return __jsx("th", {
|
|
311
|
+
key: columnId,
|
|
312
|
+
"data-col-id": index + 1
|
|
313
|
+
}, __jsx(ColumnFilterCell, {
|
|
314
|
+
columnId: columnId,
|
|
315
|
+
value: ((_columnFilters$column = columnFilters[columnId]) === null || _columnFilters$column === void 0 ? void 0 : _columnFilters$column.value) || "",
|
|
316
|
+
onChange: onColumnFilterChange,
|
|
317
|
+
widgetType: widgetType,
|
|
318
|
+
columnMeta: columnMeta,
|
|
319
|
+
columnAccessorKey: column.accessorKey,
|
|
320
|
+
renderFormWidget: renderFormWidget,
|
|
321
|
+
listener: listener
|
|
322
|
+
}));
|
|
323
|
+
}));
|
|
324
|
+
});
|
|
325
|
+
TableFilterRow.displayName = "TableFilterRow";
|