@wavemaker/react-runtime 11.14.1-rc.236
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 +10183 -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,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.renderDisplayCell = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _button = require("../../../form/button");
|
|
11
|
+
var _index = require("../../../input/default/checkbox/index");
|
|
12
|
+
var _label = require("../../../basic/label");
|
|
13
|
+
var _index2 = require("./index");
|
|
14
|
+
var _anchor = require("../../../basic/anchor");
|
|
15
|
+
var _icon = require("../../../basic/icon");
|
|
16
|
+
var _picture = require("../../../basic/picture");
|
|
17
|
+
var _lodashEs = require("lodash-es");
|
|
18
|
+
var _hooks = require("../hooks");
|
|
19
|
+
var __jsx = _react["default"].createElement;
|
|
20
|
+
/**
|
|
21
|
+
* Extracts common props from column configuration
|
|
22
|
+
*/
|
|
23
|
+
var extractCellProps = function extractCellProps(column, rowData) {
|
|
24
|
+
var fieldName = (0, _lodashEs.toString)((0, _lodashEs.get)(column, "field", ""));
|
|
25
|
+
var value = (0, _lodashEs.get)(rowData, fieldName, "");
|
|
26
|
+
|
|
27
|
+
// Extract props from column children if it's a React element
|
|
28
|
+
var childProps = /*#__PURE__*/_react["default"].isValidElement(column.children) ? (0, _lodashEs.get)(column.children, "props", {}) : {};
|
|
29
|
+
return {
|
|
30
|
+
fieldName: fieldName,
|
|
31
|
+
value: value,
|
|
32
|
+
caption: (0, _lodashEs.get)(childProps, "caption", value),
|
|
33
|
+
className: (0, _lodashEs.get)(childProps, "className", ""),
|
|
34
|
+
iconclass: (0, _lodashEs.get)(childProps, "iconclass", ""),
|
|
35
|
+
onClick: (0, _lodashEs.get)(childProps, "onClick", _lodashEs.noop)
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Creates common props for all widget components
|
|
41
|
+
*/
|
|
42
|
+
var createBaseProps = function createBaseProps(fieldName, suffix, className, listener) {
|
|
43
|
+
return {
|
|
44
|
+
name: "".concat(fieldName, "_").concat(suffix),
|
|
45
|
+
className: className,
|
|
46
|
+
listener: listener
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Widget renderer factory functions
|
|
52
|
+
*/
|
|
53
|
+
var widgetRenderers = {
|
|
54
|
+
WmButton: function WmButton(_ref) {
|
|
55
|
+
var column = _ref.column,
|
|
56
|
+
rowData = _ref.rowData,
|
|
57
|
+
listener = _ref.listener;
|
|
58
|
+
var _extractCellProps = extractCellProps(column, rowData),
|
|
59
|
+
fieldName = _extractCellProps.fieldName,
|
|
60
|
+
caption = _extractCellProps.caption,
|
|
61
|
+
className = _extractCellProps.className,
|
|
62
|
+
iconclass = _extractCellProps.iconclass,
|
|
63
|
+
_onClick = _extractCellProps.onClick;
|
|
64
|
+
var value = rowData[fieldName] || caption;
|
|
65
|
+
return __jsx(_button.WmButton, (0, _extends2["default"])({}, createBaseProps(fieldName, "button", className, listener), {
|
|
66
|
+
iconclass: iconclass,
|
|
67
|
+
caption: value || "Button",
|
|
68
|
+
onClick: function onClick(event) {
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
event.stopPropagation();
|
|
71
|
+
_onClick(rowData);
|
|
72
|
+
}
|
|
73
|
+
}));
|
|
74
|
+
},
|
|
75
|
+
WmCheckbox: function WmCheckbox(_ref2) {
|
|
76
|
+
var column = _ref2.column,
|
|
77
|
+
rowData = _ref2.rowData,
|
|
78
|
+
listener = _ref2.listener,
|
|
79
|
+
cellState = _ref2.cellState;
|
|
80
|
+
var _extractCellProps2 = extractCellProps(column, rowData),
|
|
81
|
+
fieldName = _extractCellProps2.fieldName,
|
|
82
|
+
value = _extractCellProps2.value,
|
|
83
|
+
className = _extractCellProps2.className;
|
|
84
|
+
var rowId = rowData._wmTableRowId || String(rowData.id) || "";
|
|
85
|
+
|
|
86
|
+
// Use cell state manager if available, otherwise use the value from data
|
|
87
|
+
var checkboxValue = cellState ? (0, _hooks.getCellValue)(cellState, rowId, fieldName, !!value) : !!value;
|
|
88
|
+
return __jsx(_index.WmCheckbox, (0, _extends2["default"])({}, createBaseProps(fieldName, "checkbox", className, listener), {
|
|
89
|
+
datavalue: checkboxValue,
|
|
90
|
+
onChange: function onChange(event, widget, newValue) {
|
|
91
|
+
if (cellState) {
|
|
92
|
+
(0, _hooks.setCellValue)(cellState, rowId, fieldName, newValue);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}));
|
|
96
|
+
},
|
|
97
|
+
WmAnchor: function WmAnchor(_ref3) {
|
|
98
|
+
var column = _ref3.column,
|
|
99
|
+
rowData = _ref3.rowData,
|
|
100
|
+
listener = _ref3.listener;
|
|
101
|
+
var _extractCellProps3 = extractCellProps(column, rowData),
|
|
102
|
+
fieldName = _extractCellProps3.fieldName,
|
|
103
|
+
className = _extractCellProps3.className,
|
|
104
|
+
caption = _extractCellProps3.caption;
|
|
105
|
+
var href = (0, _lodashEs.get)(rowData, column.field);
|
|
106
|
+
return __jsx(_anchor.WmAnchor, (0, _extends2["default"])({}, createBaseProps(fieldName, "anchor", className, listener), {
|
|
107
|
+
hyperlink: href || "",
|
|
108
|
+
caption: caption || href
|
|
109
|
+
}));
|
|
110
|
+
},
|
|
111
|
+
WmIcon: function WmIcon(_ref4) {
|
|
112
|
+
var column = _ref4.column,
|
|
113
|
+
rowData = _ref4.rowData,
|
|
114
|
+
listener = _ref4.listener;
|
|
115
|
+
var _extractCellProps4 = extractCellProps(column, rowData),
|
|
116
|
+
fieldName = _extractCellProps4.fieldName,
|
|
117
|
+
value = _extractCellProps4.value,
|
|
118
|
+
className = _extractCellProps4.className;
|
|
119
|
+
return __jsx(_icon.WmIcon, (0, _extends2["default"])({}, createBaseProps(fieldName, "icon", className, listener), {
|
|
120
|
+
iconclass: !(0, _lodashEs.isUndefined)(value) ? (0, _lodashEs.toString)(value) : "",
|
|
121
|
+
caption: !(0, _lodashEs.isUndefined)(value) ? (0, _lodashEs.toString)(value) : "Icon"
|
|
122
|
+
}));
|
|
123
|
+
},
|
|
124
|
+
WmPicture: function WmPicture(_ref5) {
|
|
125
|
+
var column = _ref5.column,
|
|
126
|
+
rowData = _ref5.rowData,
|
|
127
|
+
listener = _ref5.listener;
|
|
128
|
+
var _extractCellProps5 = extractCellProps(column, rowData),
|
|
129
|
+
fieldName = _extractCellProps5.fieldName,
|
|
130
|
+
value = _extractCellProps5.value,
|
|
131
|
+
caption = _extractCellProps5.caption,
|
|
132
|
+
className = _extractCellProps5.className;
|
|
133
|
+
return __jsx(_picture.WmPicture, (0, _extends2["default"])({}, createBaseProps(fieldName, "picture", className, listener), {
|
|
134
|
+
picturesource: !(0, _lodashEs.isUndefined)(value) ? (0, _lodashEs.toString)(value) : "",
|
|
135
|
+
alt: caption || "Image alt text not provided"
|
|
136
|
+
}));
|
|
137
|
+
},
|
|
138
|
+
WmLabel: function WmLabel(_ref6) {
|
|
139
|
+
var column = _ref6.column,
|
|
140
|
+
rowData = _ref6.rowData,
|
|
141
|
+
listener = _ref6.listener;
|
|
142
|
+
var _extractCellProps6 = extractCellProps(column, rowData),
|
|
143
|
+
fieldName = _extractCellProps6.fieldName,
|
|
144
|
+
value = _extractCellProps6.value,
|
|
145
|
+
className = _extractCellProps6.className;
|
|
146
|
+
return __jsx(_label.WmLabel, (0, _extends2["default"])({}, createBaseProps(fieldName, "label", className, listener), {
|
|
147
|
+
caption: !(0, _lodashEs.isUndefined)(value) ? (0, _lodashEs.toString)(value) : "Label",
|
|
148
|
+
type: "p"
|
|
149
|
+
}));
|
|
150
|
+
},
|
|
151
|
+
// Special renderer for dynamic columns - renders raw text like Angular
|
|
152
|
+
"dynamic-text": function dynamicText(_ref7) {
|
|
153
|
+
var column = _ref7.column,
|
|
154
|
+
rowData = _ref7.rowData;
|
|
155
|
+
var fieldName = (0, _lodashEs.toString)((0, _lodashEs.get)(column, "field", ""));
|
|
156
|
+
var value = (0, _lodashEs.get)(rowData, fieldName, "");
|
|
157
|
+
|
|
158
|
+
// Return raw text content directly (no WmLabel wrapper)
|
|
159
|
+
return __jsx(_react["default"].Fragment, null, !(0, _lodashEs.isUndefined)(value) ? (0, _lodashEs.toString)(value) : "");
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Renders a table cell based on the widget-type property of the column
|
|
165
|
+
* @param column - The column configuration
|
|
166
|
+
* @param rowData - The row data object
|
|
167
|
+
* @param listener - Optional event listener
|
|
168
|
+
* @param cellState - Optional cell state manager
|
|
169
|
+
* @returns React element for the cell content
|
|
170
|
+
*/
|
|
171
|
+
var renderDisplayCell = exports.renderDisplayCell = function renderDisplayCell(column, rowData, listener, cellState) {
|
|
172
|
+
var widgetType = (0, _lodashEs.get)(column, "widgetType", "label");
|
|
173
|
+
var mappedWidgetType = (0, _index2.getWidgetMappingForType)(widgetType);
|
|
174
|
+
|
|
175
|
+
// Get the appropriate renderer, defaulting to WmLabel
|
|
176
|
+
var renderer = (0, _lodashEs.get)(widgetRenderers, mappedWidgetType) || widgetRenderers.WmLabel;
|
|
177
|
+
return renderer({
|
|
178
|
+
column: column,
|
|
179
|
+
rowData: rowData,
|
|
180
|
+
listener: listener,
|
|
181
|
+
cellState: cellState
|
|
182
|
+
});
|
|
183
|
+
};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.selectionStateHelpers = exports.rowExistsInDataset = exports.isInteractiveElement = exports.hasInteractiveClass = exports.hasInteractiveAttributes = exports.getRowIdsFromDataset = void 0;
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
+
var _hooks = require("../hooks");
|
|
10
|
+
var _constants = require("./constants");
|
|
11
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
|
+
/**
|
|
15
|
+
* Check if an element has any of the interactive classes
|
|
16
|
+
*/
|
|
17
|
+
var hasInteractiveClass = exports.hasInteractiveClass = function hasInteractiveClass(element) {
|
|
18
|
+
if (!element.className || typeof element.className !== "string") return false;
|
|
19
|
+
var className = element.className;
|
|
20
|
+
var _iterator = _createForOfIteratorHelper(_constants.INTERACTIVE_CLASSES),
|
|
21
|
+
_step;
|
|
22
|
+
try {
|
|
23
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
24
|
+
var interactiveClass = _step.value;
|
|
25
|
+
if (className.includes(interactiveClass)) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
} catch (err) {
|
|
30
|
+
_iterator.e(err);
|
|
31
|
+
} finally {
|
|
32
|
+
_iterator.f();
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Check if an element has interactive attributes
|
|
39
|
+
*/
|
|
40
|
+
var hasInteractiveAttributes = exports.hasInteractiveAttributes = function hasInteractiveAttributes(element) {
|
|
41
|
+
// Check contenteditable
|
|
42
|
+
if (element.getAttribute("contenteditable") === "true") {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Check role attribute
|
|
47
|
+
var role = element.getAttribute("role");
|
|
48
|
+
if (role && _constants.INTERACTIVE_ROLES.includes(role)) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Check data-role attribute
|
|
53
|
+
var dataRole = element.getAttribute("data-role");
|
|
54
|
+
if (dataRole) {
|
|
55
|
+
var _iterator2 = _createForOfIteratorHelper(_constants.INTERACTIVE_DATA_ROLES),
|
|
56
|
+
_step2;
|
|
57
|
+
try {
|
|
58
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
59
|
+
var interactiveRole = _step2.value;
|
|
60
|
+
if (dataRole.includes(interactiveRole)) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
} catch (err) {
|
|
65
|
+
_iterator2.e(err);
|
|
66
|
+
} finally {
|
|
67
|
+
_iterator2.f();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Check if element or its ancestors are interactive
|
|
75
|
+
*/
|
|
76
|
+
var isInteractiveElement = exports.isInteractiveElement = function isInteractiveElement(event) {
|
|
77
|
+
var target = event.target;
|
|
78
|
+
|
|
79
|
+
// Check if it's a standard interactive HTML element
|
|
80
|
+
if (_constants.INTERACTIVE_TAG_NAMES.includes(target.tagName)) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Check element and its ancestors
|
|
85
|
+
var element = target;
|
|
86
|
+
while (element) {
|
|
87
|
+
if (hasInteractiveClass(element) || hasInteractiveAttributes(element)) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
element = element.parentElement;
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Get row IDs from dataset
|
|
97
|
+
*/
|
|
98
|
+
var getRowIdsFromDataset = exports.getRowIdsFromDataset = function getRowIdsFromDataset(dataset) {
|
|
99
|
+
return dataset.map(function (row) {
|
|
100
|
+
return row._wmTableRowId || String(row.id);
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Check if a row exists in dataset
|
|
106
|
+
*/
|
|
107
|
+
var rowExistsInDataset = exports.rowExistsInDataset = function rowExistsInDataset(rowId, dataset) {
|
|
108
|
+
return dataset.some(function (row) {
|
|
109
|
+
return row._wmTableRowId === rowId || String(row.id) === rowId;
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Selection state management functions
|
|
115
|
+
*/
|
|
116
|
+
var selectionStateHelpers = exports.selectionStateHelpers = {
|
|
117
|
+
// Radio selection
|
|
118
|
+
setRadioSelection: function setRadioSelection(cellState, rowId) {
|
|
119
|
+
(0, _hooks.setSelectedRowId)(cellState, rowId);
|
|
120
|
+
},
|
|
121
|
+
getRadioSelection: function getRadioSelection(cellState) {
|
|
122
|
+
return (0, _hooks.getSelectedRowId)(cellState);
|
|
123
|
+
},
|
|
124
|
+
// Multi selection
|
|
125
|
+
addToMultiSelection: function addToMultiSelection(cellState, rowId) {
|
|
126
|
+
var current = (0, _hooks.getSelectedRowIds)(cellState);
|
|
127
|
+
if (!current.includes(rowId)) {
|
|
128
|
+
(0, _hooks.setSelectedRowIds)(cellState, [].concat((0, _toConsumableArray2["default"])(current), [rowId]));
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
removeFromMultiSelection: function removeFromMultiSelection(cellState, rowId) {
|
|
132
|
+
var current = (0, _hooks.getSelectedRowIds)(cellState);
|
|
133
|
+
(0, _hooks.setSelectedRowIds)(cellState, current.filter(function (id) {
|
|
134
|
+
return id !== rowId;
|
|
135
|
+
}));
|
|
136
|
+
},
|
|
137
|
+
toggleMultiSelection: function toggleMultiSelection(cellState, rowId) {
|
|
138
|
+
var current = (0, _hooks.getSelectedRowIds)(cellState);
|
|
139
|
+
var isSelected = current.includes(rowId);
|
|
140
|
+
if (isSelected) {
|
|
141
|
+
selectionStateHelpers.removeFromMultiSelection(cellState, rowId);
|
|
142
|
+
} else {
|
|
143
|
+
selectionStateHelpers.addToMultiSelection(cellState, rowId);
|
|
144
|
+
}
|
|
145
|
+
return !isSelected;
|
|
146
|
+
},
|
|
147
|
+
setAllMultiSelection: function setAllMultiSelection(cellState, rowIds) {
|
|
148
|
+
(0, _hooks.setSelectedRowIds)(cellState, rowIds);
|
|
149
|
+
},
|
|
150
|
+
clearMultiSelection: function clearMultiSelection(cellState) {
|
|
151
|
+
(0, _hooks.setSelectedRowIds)(cellState, []);
|
|
152
|
+
},
|
|
153
|
+
getMultiSelection: function getMultiSelection(cellState) {
|
|
154
|
+
return (0, _hooks.getSelectedRowIds)(cellState);
|
|
155
|
+
},
|
|
156
|
+
// Check selection
|
|
157
|
+
isRowSelected: function isRowSelected(cellState, rowId, useMultiSelect, useRadioSelect) {
|
|
158
|
+
if (useMultiSelect) {
|
|
159
|
+
return (0, _hooks.getSelectedRowIds)(cellState).includes(rowId);
|
|
160
|
+
} else {
|
|
161
|
+
// For radio select or default mode (when neither is explicitly enabled),
|
|
162
|
+
// check radio selection
|
|
163
|
+
return (0, _hooks.getSelectedRowId)(cellState) === rowId;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.saveTableState = exports.getTableState = exports.convertFilterObjectToArray = exports.convertFilterArrayToObject = exports.clearTableState = void 0;
|
|
7
|
+
var _statePersistance = require("@wavemaker/react-runtime/utils/state-persistance");
|
|
8
|
+
var _lodashEs = require("lodash-es");
|
|
9
|
+
// Type definition for search/filter item
|
|
10
|
+
|
|
11
|
+
// Type definition for filter field object format (for datasource)
|
|
12
|
+
|
|
13
|
+
// Type definition for filter fields object (for datasource.invoke)
|
|
14
|
+
|
|
15
|
+
// Type definition for sort state
|
|
16
|
+
|
|
17
|
+
// Type definition for table state
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Save table state
|
|
21
|
+
* @param name - Table widget name
|
|
22
|
+
* @param storage - Storage type (session/local)
|
|
23
|
+
* @param stateToSave - State object to save
|
|
24
|
+
*/
|
|
25
|
+
var saveTableState = exports.saveTableState = function saveTableState(name, storage, stateToSave) {
|
|
26
|
+
// Simply save the provided state
|
|
27
|
+
(0, _statePersistance.setWidgetState)({
|
|
28
|
+
name: name,
|
|
29
|
+
type: "table",
|
|
30
|
+
storage: storage
|
|
31
|
+
}, stateToSave);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Get table state from storage
|
|
36
|
+
* @param name - Table widget name
|
|
37
|
+
* @param storage - Storage type (session/local)
|
|
38
|
+
* @returns Table state data or null
|
|
39
|
+
*/
|
|
40
|
+
var getTableState = exports.getTableState = function getTableState(name, storage) {
|
|
41
|
+
var state = (0, _statePersistance.getWidgetState)({
|
|
42
|
+
name: name,
|
|
43
|
+
type: "table",
|
|
44
|
+
storage: storage
|
|
45
|
+
});
|
|
46
|
+
return state;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Clear table state from storage
|
|
51
|
+
* @param name - Table widget name
|
|
52
|
+
* @param storage - Storage type (session/local)
|
|
53
|
+
*/
|
|
54
|
+
var clearTableState = exports.clearTableState = function clearTableState(name, storage) {
|
|
55
|
+
(0, _statePersistance.clearWidgetState)({
|
|
56
|
+
name: name,
|
|
57
|
+
storage: storage,
|
|
58
|
+
type: "table"
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Convert filter array format to object format for datasource.invoke
|
|
64
|
+
* @param filterArray - Array of TableSearchFilter items
|
|
65
|
+
* @param defaultLogicalOp - Default logical operator (default: 'AND')
|
|
66
|
+
* @returns FilterFieldsObject for datasource
|
|
67
|
+
*/
|
|
68
|
+
var convertFilterArrayToObject = exports.convertFilterArrayToObject = function convertFilterArrayToObject(filterArray) {
|
|
69
|
+
var defaultLogicalOp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "AND";
|
|
70
|
+
var filterObject = {};
|
|
71
|
+
(0, _lodashEs.forEach)(filterArray, function (filter) {
|
|
72
|
+
if (filter.field) {
|
|
73
|
+
filterObject[filter.field] = {
|
|
74
|
+
value: filter.value,
|
|
75
|
+
logicalOp: defaultLogicalOp,
|
|
76
|
+
matchMode: filter.matchMode || "anywhereignorecase",
|
|
77
|
+
type: filter.type
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
return filterObject;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Convert filter object format to array format for internal state
|
|
86
|
+
* @param filterObject - FilterFieldsObject from datasource
|
|
87
|
+
* @returns Array of TableSearchFilter items
|
|
88
|
+
*/
|
|
89
|
+
var convertFilterObjectToArray = exports.convertFilterObjectToArray = function convertFilterObjectToArray(filterObject) {
|
|
90
|
+
var filterArray = [];
|
|
91
|
+
(0, _lodashEs.forEach)(filterObject, function (filter, field) {
|
|
92
|
+
filterArray.push({
|
|
93
|
+
field: field,
|
|
94
|
+
value: filter.value,
|
|
95
|
+
matchMode: filter.matchMode || "anywhereignorecase",
|
|
96
|
+
type: filter.type || "string"
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
return filterArray;
|
|
100
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.validateField = exports.updateValidationErrors = exports.resetValidationState = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _lodashEs = require("lodash-es");
|
|
10
|
+
/**
|
|
11
|
+
* Validates a single field and updates validation state
|
|
12
|
+
*/
|
|
13
|
+
var validateField = exports.validateField = function validateField(rowId, fieldName, value, column, validationState) {
|
|
14
|
+
var _cellUpdateCallbacks$5, _cellUpdateCallbacks$6;
|
|
15
|
+
var fieldKey = "".concat(rowId, "_").concat(fieldName);
|
|
16
|
+
var fieldRefs = validationState.fieldRefs,
|
|
17
|
+
fieldValidationErrors = validationState.fieldValidationErrors,
|
|
18
|
+
cellUpdateCallbacks = validationState.cellUpdateCallbacks;
|
|
19
|
+
|
|
20
|
+
// Check required validation
|
|
21
|
+
if (column !== null && column !== void 0 && column.required && (value === undefined || value === null || value === "")) {
|
|
22
|
+
var _cellUpdateCallbacks$, _cellUpdateCallbacks$2;
|
|
23
|
+
fieldValidationErrors.current[fieldKey] = true;
|
|
24
|
+
(_cellUpdateCallbacks$ = (_cellUpdateCallbacks$2 = cellUpdateCallbacks.current)[fieldKey]) === null || _cellUpdateCallbacks$ === void 0 || _cellUpdateCallbacks$.call(_cellUpdateCallbacks$2);
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Check HTML5 validation
|
|
29
|
+
var fieldElement = fieldRefs.current[fieldKey];
|
|
30
|
+
if (fieldElement) {
|
|
31
|
+
var input = fieldElement.querySelector("input, textarea, select");
|
|
32
|
+
if (input && !input.validity.valid) {
|
|
33
|
+
var _cellUpdateCallbacks$3, _cellUpdateCallbacks$4;
|
|
34
|
+
fieldValidationErrors.current[fieldKey] = true;
|
|
35
|
+
(_cellUpdateCallbacks$3 = (_cellUpdateCallbacks$4 = cellUpdateCallbacks.current)[fieldKey]) === null || _cellUpdateCallbacks$3 === void 0 || _cellUpdateCallbacks$3.call(_cellUpdateCallbacks$4);
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Mark as valid
|
|
41
|
+
fieldValidationErrors.current[fieldKey] = false;
|
|
42
|
+
(_cellUpdateCallbacks$5 = (_cellUpdateCallbacks$6 = cellUpdateCallbacks.current)[fieldKey]) === null || _cellUpdateCallbacks$5 === void 0 || _cellUpdateCallbacks$5.call(_cellUpdateCallbacks$6);
|
|
43
|
+
return true;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Resets validation state for specific context
|
|
48
|
+
*/
|
|
49
|
+
var resetValidationState = exports.resetValidationState = function resetValidationState(context, editingRowId, validationState) {
|
|
50
|
+
var fieldRefs = validationState.fieldRefs,
|
|
51
|
+
fieldValidationErrors = validationState.fieldValidationErrors,
|
|
52
|
+
cellUpdateCallbacks = validationState.cellUpdateCallbacks;
|
|
53
|
+
if (context === "editing" && editingRowId) {
|
|
54
|
+
// Clear only editing row fields
|
|
55
|
+
(0, _lodashEs.forEach)((0, _lodashEs.keys)(fieldRefs.current), function (key) {
|
|
56
|
+
if (key.startsWith("".concat(editingRowId, "_"))) {
|
|
57
|
+
delete fieldRefs.current[key];
|
|
58
|
+
delete fieldValidationErrors.current[key];
|
|
59
|
+
delete cellUpdateCallbacks.current[key];
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
} else if (context === "new-row") {
|
|
63
|
+
// Clear only new row fields
|
|
64
|
+
(0, _lodashEs.forEach)((0, _lodashEs.keys)(fieldRefs.current), function (key) {
|
|
65
|
+
if (key.startsWith("new-row_")) {
|
|
66
|
+
delete fieldRefs.current[key];
|
|
67
|
+
delete fieldValidationErrors.current[key];
|
|
68
|
+
delete cellUpdateCallbacks.current[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
} else {
|
|
72
|
+
// Clear all
|
|
73
|
+
(0, _lodashEs.forEach)((0, _lodashEs.keys)(fieldRefs.current), function (key) {
|
|
74
|
+
delete fieldRefs.current[key];
|
|
75
|
+
});
|
|
76
|
+
fieldValidationErrors.current = {};
|
|
77
|
+
cellUpdateCallbacks.current = {};
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Updates validation errors for fields based on validation results
|
|
83
|
+
*/
|
|
84
|
+
var updateValidationErrors = exports.updateValidationErrors = function updateValidationErrors(validationResult, relevantFieldRefs, validationState) {
|
|
85
|
+
var fieldValidationErrors = validationState.fieldValidationErrors,
|
|
86
|
+
cellUpdateCallbacks = validationState.cellUpdateCallbacks;
|
|
87
|
+
|
|
88
|
+
// Initialize all fields as valid
|
|
89
|
+
var errors = {};
|
|
90
|
+
(0, _lodashEs.forEach)((0, _lodashEs.keys)(relevantFieldRefs), function (fieldKey) {
|
|
91
|
+
errors[fieldKey] = false;
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// If we have the invalidFieldKeys property, use it directly
|
|
95
|
+
if (validationResult.invalidFieldKeys && validationResult.invalidFieldKeys.length > 0) {
|
|
96
|
+
(0, _lodashEs.forEach)(validationResult.invalidFieldKeys, function (fieldKey) {
|
|
97
|
+
errors[fieldKey] = true;
|
|
98
|
+
});
|
|
99
|
+
} else {
|
|
100
|
+
// Fallback to the previous method using invalidElements
|
|
101
|
+
validationResult.invalidElements.forEach(function (invalidElement) {
|
|
102
|
+
(0, _lodashEs.forEach)((0, _lodashEs.entries)(relevantFieldRefs), function (_ref) {
|
|
103
|
+
var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
|
|
104
|
+
fieldKey = _ref2[0],
|
|
105
|
+
fieldElement = _ref2[1];
|
|
106
|
+
if (fieldElement === invalidElement || fieldElement !== null && fieldElement !== void 0 && fieldElement.contains(invalidElement)) {
|
|
107
|
+
errors[fieldKey] = true;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Update validation errors for each field key
|
|
114
|
+
(0, _lodashEs.forEach)((0, _lodashEs.entries)(errors), function (_ref3) {
|
|
115
|
+
var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2),
|
|
116
|
+
fieldKey = _ref4[0],
|
|
117
|
+
hasError = _ref4[1];
|
|
118
|
+
if (fieldValidationErrors.current[fieldKey] !== hasError) {
|
|
119
|
+
var _cellUpdateCallbacks$7, _cellUpdateCallbacks$8;
|
|
120
|
+
fieldValidationErrors.current[fieldKey] = hasError;
|
|
121
|
+
(_cellUpdateCallbacks$7 = (_cellUpdateCallbacks$8 = cellUpdateCallbacks.current)[fieldKey]) === null || _cellUpdateCallbacks$7 === void 0 || _cellUpdateCallbacks$7.call(_cellUpdateCallbacks$8);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MatchMode = exports.FormWidgetType = exports.DataType = exports.DataSource = void 0;
|
|
7
|
+
var Operation = /*#__PURE__*/function (Operation) {
|
|
8
|
+
Operation["LIST_RECORDS"] = "listRecords";
|
|
9
|
+
Operation["UPDATE_RECORD"] = "updateRecord";
|
|
10
|
+
Operation["INSERT_RECORD"] = "insertRecord";
|
|
11
|
+
Operation["DELETE_RECORD"] = "deleteRecord";
|
|
12
|
+
Operation["INVOKE"] = "invoke";
|
|
13
|
+
Operation["UPDATE"] = "update";
|
|
14
|
+
Operation["NOTIFY"] = "notify";
|
|
15
|
+
Operation["IS_API_AWARE"] = "isApiAware";
|
|
16
|
+
Operation["SUPPORTS_CRUD"] = "supportsCRUD";
|
|
17
|
+
Operation["SUPPORTS_DISTINCT_API"] = "supportsDistinctAPI";
|
|
18
|
+
Operation["IS_PAGEABLE"] = "isPageable";
|
|
19
|
+
Operation["IS_SORTABLE"] = "isSortable";
|
|
20
|
+
Operation["GET_OPERATION_TYPE"] = "getOperationType";
|
|
21
|
+
Operation["GET_RELATED_PRIMARY_KEYS"] = "getRelatedTablePrimaryKeys";
|
|
22
|
+
Operation["GET_ENTITY_NAME"] = "getEntityName";
|
|
23
|
+
Operation["SET_INPUT"] = "setinput";
|
|
24
|
+
Operation["GET_RELATED_TABLE_DATA"] = "getRelatedTableData";
|
|
25
|
+
Operation["GET_DISTINCT_DATA_BY_FIELDS"] = "getDistinctDataByFields";
|
|
26
|
+
Operation["GET_AGGREGATED_DATA"] = "getAggregatedData";
|
|
27
|
+
Operation["GET_MATCH_MODE"] = "getMatchMode";
|
|
28
|
+
Operation["DOWNLOAD"] = "download";
|
|
29
|
+
Operation["GET_NAME"] = "getName";
|
|
30
|
+
Operation["GET_PROPERTIES_MAP"] = "getPropertiesMap";
|
|
31
|
+
Operation["GET_PRIMARY_KEY"] = "getPrimaryKey";
|
|
32
|
+
Operation["GET_BLOB_URL"] = "getBlobURL";
|
|
33
|
+
Operation["SUPPORTS_SERVER_FILTER"] = "supportsServerFilter";
|
|
34
|
+
Operation["GET_OPTIONS"] = "getOptions";
|
|
35
|
+
Operation["SEARCH_RECORDS"] = "searchRecords";
|
|
36
|
+
Operation["GET_REQUEST_PARAMS"] = "getRequestParams";
|
|
37
|
+
Operation["GET_PAGING_OPTIONS"] = "getPagingOptions";
|
|
38
|
+
Operation["FETCH_DISTINCT_VALUES"] = "fetchDistinctValues";
|
|
39
|
+
Operation["GET_UNIQUE_IDENTIFIER"] = "getUniqueIdentifier";
|
|
40
|
+
Operation["GET_CONTEXT_IDENTIFIER"] = "getContextIdentifier";
|
|
41
|
+
Operation["IS_UPDATE_REQUIRED"] = "isUpdateRequired";
|
|
42
|
+
Operation["ADD_ITEM"] = "addItem";
|
|
43
|
+
Operation["SET_ITEM"] = "setItem";
|
|
44
|
+
Operation["REMOVE_ITEM"] = "removeItem";
|
|
45
|
+
Operation["IS_BOUND_TO_LOCALE"] = "isBoundToLocale";
|
|
46
|
+
Operation["GET_DEFAULT_LOCALE"] = "getDefaultLocale";
|
|
47
|
+
Operation["CANCEL"] = "cancel";
|
|
48
|
+
Operation["SET_PAGINATION"] = "setPagination";
|
|
49
|
+
return Operation;
|
|
50
|
+
}(Operation || {});
|
|
51
|
+
var DataSource = exports.DataSource = {
|
|
52
|
+
Operation: Operation
|
|
53
|
+
};
|
|
54
|
+
var MatchMode = exports.MatchMode = /*#__PURE__*/function (MatchMode) {
|
|
55
|
+
MatchMode["BETWEEN"] = "between";
|
|
56
|
+
MatchMode["GREATER"] = "greaterthanequal";
|
|
57
|
+
MatchMode["LESSER"] = "lessthanequal";
|
|
58
|
+
MatchMode["NULL"] = "null";
|
|
59
|
+
MatchMode["EMPTY"] = "empty";
|
|
60
|
+
MatchMode["NULLOREMPTY"] = "nullorempty";
|
|
61
|
+
MatchMode["EQUALS"] = "exact";
|
|
62
|
+
return MatchMode;
|
|
63
|
+
}({});
|
|
64
|
+
var FormWidgetType = exports.FormWidgetType = /*#__PURE__*/function (FormWidgetType) {
|
|
65
|
+
FormWidgetType["AUTOCOMPLETE"] = "autocomplete";
|
|
66
|
+
FormWidgetType["CHECKBOX"] = "checkbox";
|
|
67
|
+
FormWidgetType["CHECKBOXSET"] = "checkboxset";
|
|
68
|
+
FormWidgetType["CHIPS"] = "chips";
|
|
69
|
+
FormWidgetType["COLORPICKER"] = "colorpicker";
|
|
70
|
+
FormWidgetType["CURRENCY"] = "currency";
|
|
71
|
+
FormWidgetType["CUSTOMWIDGET"] = "custom-widget";
|
|
72
|
+
FormWidgetType["DATE"] = "date";
|
|
73
|
+
FormWidgetType["DATETIME"] = "datetime";
|
|
74
|
+
FormWidgetType["NUMBER"] = "number";
|
|
75
|
+
FormWidgetType["PASSWORD"] = "password";
|
|
76
|
+
FormWidgetType["RADIOSET"] = "radioset";
|
|
77
|
+
FormWidgetType["RATING"] = "rating";
|
|
78
|
+
FormWidgetType["RICHTEXT"] = "richtext";
|
|
79
|
+
FormWidgetType["SELECT"] = "select";
|
|
80
|
+
FormWidgetType["TOGGLE"] = "toggle";
|
|
81
|
+
FormWidgetType["SLIDER"] = "slider";
|
|
82
|
+
FormWidgetType["SWITCH"] = "switch";
|
|
83
|
+
FormWidgetType["TEXT"] = "text";
|
|
84
|
+
FormWidgetType["TEXTAREA"] = "textarea";
|
|
85
|
+
FormWidgetType["TIME"] = "time";
|
|
86
|
+
FormWidgetType["TIMESTAMP"] = "timestamp";
|
|
87
|
+
FormWidgetType["TYPEAHEAD"] = "typeahead";
|
|
88
|
+
FormWidgetType["UPLOAD"] = "upload";
|
|
89
|
+
return FormWidgetType;
|
|
90
|
+
}({});
|
|
91
|
+
var DataType = exports.DataType = /*#__PURE__*/function (DataType) {
|
|
92
|
+
DataType["INTEGER"] = "integer";
|
|
93
|
+
DataType["BIG_INTEGER"] = "big_integer";
|
|
94
|
+
DataType["SHORT"] = "short";
|
|
95
|
+
DataType["FLOAT"] = "float";
|
|
96
|
+
DataType["BIG_DECIMAL"] = "big_decimal";
|
|
97
|
+
DataType["DOUBLE"] = "double";
|
|
98
|
+
DataType["LONG"] = "long";
|
|
99
|
+
DataType["BYTE"] = "byte";
|
|
100
|
+
DataType["STRING"] = "string";
|
|
101
|
+
DataType["CHARACTER"] = "character";
|
|
102
|
+
DataType["TEXT"] = "text";
|
|
103
|
+
DataType["DATE"] = "date";
|
|
104
|
+
DataType["TIME"] = "time";
|
|
105
|
+
DataType["TIMESTAMP"] = "timestamp";
|
|
106
|
+
DataType["DATETIME"] = "datetime";
|
|
107
|
+
DataType["LOCALDATETIME"] = "localdatetime";
|
|
108
|
+
DataType["BOOLEAN"] = "boolean";
|
|
109
|
+
DataType["LIST"] = "list";
|
|
110
|
+
DataType["CLOB"] = "clob";
|
|
111
|
+
DataType["BLOB"] = "blob";
|
|
112
|
+
return DataType;
|
|
113
|
+
}({});
|