@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,607 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
var _exportNames = {
|
|
8
|
+
addUniqueRowIds: true,
|
|
9
|
+
getWidgetMappingForType: true,
|
|
10
|
+
getBooleanDataset: true,
|
|
11
|
+
isColumnVisibleForViewport: true,
|
|
12
|
+
parseTableColumns: true,
|
|
13
|
+
parseTableRowActions: true,
|
|
14
|
+
parseTableActions: true,
|
|
15
|
+
parseTableRowExpansion: true,
|
|
16
|
+
isEditAction: true,
|
|
17
|
+
isDeleteAction: true,
|
|
18
|
+
isAddNewAction: true,
|
|
19
|
+
getActionButtonClass: true,
|
|
20
|
+
getTableActionButtonClass: true,
|
|
21
|
+
validateEditingFields: true,
|
|
22
|
+
getButtonClasses: true,
|
|
23
|
+
getSpacingClasses: true,
|
|
24
|
+
shouldShowPagination: true,
|
|
25
|
+
shouldShowPanelHeading: true,
|
|
26
|
+
handleNewRowNavigation: true,
|
|
27
|
+
INTERNAL_PROPERTIES: true,
|
|
28
|
+
cleanRowData: true,
|
|
29
|
+
parseWidth: true
|
|
30
|
+
};
|
|
31
|
+
exports.validateEditingFields = exports.shouldShowPanelHeading = exports.shouldShowPagination = exports.parseWidth = exports.parseTableRowExpansion = exports.parseTableRowActions = exports.parseTableColumns = exports.parseTableActions = exports.isEditAction = exports.isDeleteAction = exports.isColumnVisibleForViewport = exports.isAddNewAction = exports.handleNewRowNavigation = exports.getWidgetMappingForType = exports.getTableActionButtonClass = exports.getSpacingClasses = exports.getButtonClasses = exports.getBooleanDataset = exports.getActionButtonClass = exports.cleanRowData = exports.addUniqueRowIds = exports.INTERNAL_PROPERTIES = void 0;
|
|
32
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
33
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
34
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
35
|
+
var _lodashEs = require("lodash-es");
|
|
36
|
+
var _react = _interopRequireDefault(require("react"));
|
|
37
|
+
var _constants = require("./constants");
|
|
38
|
+
Object.keys(_constants).forEach(function (key) {
|
|
39
|
+
if (key === "default" || key === "__esModule") return;
|
|
40
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
41
|
+
if (key in exports && exports[key] === _constants[key]) return;
|
|
42
|
+
Object.defineProperty(exports, key, {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function get() {
|
|
45
|
+
return _constants[key];
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
var _renderDisplayCell = require("./renderDisplayCell");
|
|
50
|
+
Object.keys(_renderDisplayCell).forEach(function (key) {
|
|
51
|
+
if (key === "default" || key === "__esModule") return;
|
|
52
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
53
|
+
if (key in exports && exports[key] === _renderDisplayCell[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function get() {
|
|
57
|
+
return _renderDisplayCell[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var _buildSelectionColumns = require("./buildSelectionColumns");
|
|
62
|
+
Object.keys(_buildSelectionColumns).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
65
|
+
if (key in exports && exports[key] === _buildSelectionColumns[key]) return;
|
|
66
|
+
Object.defineProperty(exports, key, {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function get() {
|
|
69
|
+
return _buildSelectionColumns[key];
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
var _validation = require("./validation");
|
|
74
|
+
Object.keys(_validation).forEach(function (key) {
|
|
75
|
+
if (key === "default" || key === "__esModule") return;
|
|
76
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
77
|
+
if (key in exports && exports[key] === _validation[key]) return;
|
|
78
|
+
Object.defineProperty(exports, key, {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function get() {
|
|
81
|
+
return _validation[key];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
var _selectionUtils = require("./selectionUtils");
|
|
86
|
+
Object.keys(_selectionUtils).forEach(function (key) {
|
|
87
|
+
if (key === "default" || key === "__esModule") return;
|
|
88
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
89
|
+
if (key in exports && exports[key] === _selectionUtils[key]) return;
|
|
90
|
+
Object.defineProperty(exports, key, {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function get() {
|
|
93
|
+
return _selectionUtils[key];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
var _columnBuilder = require("./columnBuilder");
|
|
98
|
+
Object.keys(_columnBuilder).forEach(function (key) {
|
|
99
|
+
if (key === "default" || key === "__esModule") return;
|
|
100
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
101
|
+
if (key in exports && exports[key] === _columnBuilder[key]) return;
|
|
102
|
+
Object.defineProperty(exports, key, {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function get() {
|
|
105
|
+
return _columnBuilder[key];
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
var _columnWidthDistribution = require("./columnWidthDistribution");
|
|
110
|
+
Object.keys(_columnWidthDistribution).forEach(function (key) {
|
|
111
|
+
if (key === "default" || key === "__esModule") return;
|
|
112
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
113
|
+
if (key in exports && exports[key] === _columnWidthDistribution[key]) return;
|
|
114
|
+
Object.defineProperty(exports, key, {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
get: function get() {
|
|
117
|
+
return _columnWidthDistribution[key];
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
var _tableHelpers = require("./table-helpers");
|
|
122
|
+
Object.keys(_tableHelpers).forEach(function (key) {
|
|
123
|
+
if (key === "default" || key === "__esModule") return;
|
|
124
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
125
|
+
if (key in exports && exports[key] === _tableHelpers[key]) return;
|
|
126
|
+
Object.defineProperty(exports, key, {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
get: function get() {
|
|
129
|
+
return _tableHelpers[key];
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
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; }
|
|
134
|
+
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; }
|
|
135
|
+
var formWidgets = ["WmText", "WmTextarea", "WmCheckbox", "WmSlider", "WmCurrency", "WmSwitch", "WmSelect", "WmCheckboxSet", "WmRadioSet", "WmDate", "WmTime", "WmTimestamp", "WmRating", "WmDatetime", "WmSearch", "WmChips", "WmColorPicker"];
|
|
136
|
+
var hashString = function hashString(str, index) {
|
|
137
|
+
var hash = 5381;
|
|
138
|
+
for (var i = 0; i < str.length; i++) {
|
|
139
|
+
hash = (hash << 5) + hash + str.charCodeAt(i);
|
|
140
|
+
hash = hash & hash; // Convert to 32bit integer
|
|
141
|
+
}
|
|
142
|
+
return "row_".concat(Math.abs(hash), "_").concat(index);
|
|
143
|
+
};
|
|
144
|
+
var generateDeterministicHash = function generateDeterministicHash(obj, index) {
|
|
145
|
+
var hashSource = index.toString() + ((0, _lodashEs.isObject)(obj) ? (0, _lodashEs.transform)((0, _lodashEs.omit)(obj, "_wmTableRowId"), function (result, value, key) {
|
|
146
|
+
if (!(0, _lodashEs.isNil)(value)) {
|
|
147
|
+
result.push("".concat(key, ":").concat((0, _lodashEs.isObject)(value) ? JSON.stringify(value) : String(value)));
|
|
148
|
+
}
|
|
149
|
+
}, []).sort().join("|") : String(obj));
|
|
150
|
+
return hashString(hashSource, index);
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Adds unique row IDs to the dataset if they don't already have them.
|
|
155
|
+
* Uses _wmTableRowId or _wmListItemId as the primary key, falling back to a generated ID.
|
|
156
|
+
*
|
|
157
|
+
* @param dataset - The dataset to process
|
|
158
|
+
* @param options - Options for ID generation
|
|
159
|
+
* @param options.type - Type of widget ('table' or 'list')
|
|
160
|
+
* @param options.idProperty - Custom property name for the ID (defaults to _wmTableRowId for table, _wmListItemId for list)
|
|
161
|
+
* @returns The dataset with unique row IDs added
|
|
162
|
+
*/
|
|
163
|
+
var addUniqueRowIds = exports.addUniqueRowIds = function addUniqueRowIds(dataset) {
|
|
164
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
165
|
+
// Handle non-array inputs (e.g., empty objects, null, undefined)
|
|
166
|
+
if (!(0, _lodashEs.isArray)(dataset)) {
|
|
167
|
+
return [];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Determine the ID property based on type or custom property
|
|
171
|
+
var idProperty = options.idProperty || (options.type === "list" ? "_wmListItemId" : "_wmTableRowId");
|
|
172
|
+
return (0, _lodashEs.map)(dataset, function (item, index) {
|
|
173
|
+
// If item is not an object (primitive values like strings, numbers), return as-is
|
|
174
|
+
if ((0, _typeof2["default"])(item) !== "object" || item === null || (0, _lodashEs.isArray)(item)) {
|
|
175
|
+
return item;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Skip if the item already has a unique row ID
|
|
179
|
+
if (item[idProperty]) {
|
|
180
|
+
return item;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Generate a unique ID based on existing id field or create a deterministic hash
|
|
184
|
+
var rowId = item.id || item.ID || item.Id || generateDeterministicHash(item, index);
|
|
185
|
+
|
|
186
|
+
// Use spread operator for objects to add the ID property
|
|
187
|
+
return _objectSpread(_objectSpread({}, item), {}, (0, _defineProperty2["default"])({}, idProperty, rowId));
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
// Widget mapping utilities
|
|
192
|
+
var getWidgetMappingForType = exports.getWidgetMappingForType = function getWidgetMappingForType(widgetType) {
|
|
193
|
+
var widgetMappings = {
|
|
194
|
+
text: "WmText",
|
|
195
|
+
password: "WmPassword",
|
|
196
|
+
textarea: "WmTextarea",
|
|
197
|
+
number: "WmNumber",
|
|
198
|
+
checkbox: "WmCheckbox",
|
|
199
|
+
toggle: "WmToggle",
|
|
200
|
+
"switch": "WmSwitch",
|
|
201
|
+
slider: "WmSlider",
|
|
202
|
+
richtext: "WmRichtext",
|
|
203
|
+
richtexteditor: "WmRichtexteditor",
|
|
204
|
+
currency: "WmCurrency",
|
|
205
|
+
select: "WmSelect",
|
|
206
|
+
checkboxset: "WmCheckboxset",
|
|
207
|
+
radioset: "WmRadioset",
|
|
208
|
+
date: "WmDate",
|
|
209
|
+
time: "WmTime",
|
|
210
|
+
timestamp: "WmTimestamp",
|
|
211
|
+
datetime: "WmDatetime",
|
|
212
|
+
rating: "WmRating",
|
|
213
|
+
autocomplete: "WmAutocomplete",
|
|
214
|
+
chips: "WmChips",
|
|
215
|
+
colorpicker: "WmColorpicker",
|
|
216
|
+
upload: "WmFileupload",
|
|
217
|
+
label: "WmLabel",
|
|
218
|
+
button: "WmButton",
|
|
219
|
+
icon: "WmIcon",
|
|
220
|
+
image: "WmPicture",
|
|
221
|
+
anchor: "WmAnchor"
|
|
222
|
+
};
|
|
223
|
+
return widgetMappings[widgetType] || widgetType;
|
|
224
|
+
};
|
|
225
|
+
var getBooleanDataset = exports.getBooleanDataset = function getBooleanDataset() {
|
|
226
|
+
return [{
|
|
227
|
+
key: true,
|
|
228
|
+
value: "Yes"
|
|
229
|
+
}, {
|
|
230
|
+
key: false,
|
|
231
|
+
value: "No"
|
|
232
|
+
}];
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
// Check if column should be visible based on current viewport
|
|
236
|
+
var isColumnVisibleForViewport = exports.isColumnVisibleForViewport = function isColumnVisibleForViewport(column, viewportWidth) {
|
|
237
|
+
// Validate inputs
|
|
238
|
+
if (!column || typeof viewportWidth !== "number" || viewportWidth < 0) {
|
|
239
|
+
return true; // Default to showing column if invalid inputs
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// Define breakpoints (matching Bootstrap)
|
|
243
|
+
var MOBILE_BREAKPOINT = 576;
|
|
244
|
+
var TABLET_BREAKPOINT = 768;
|
|
245
|
+
var DESKTOP_BREAKPOINT = 992;
|
|
246
|
+
|
|
247
|
+
// Determine current device type
|
|
248
|
+
var isMobile = viewportWidth < MOBILE_BREAKPOINT;
|
|
249
|
+
var isTablet = viewportWidth >= MOBILE_BREAKPOINT && viewportWidth < DESKTOP_BREAKPOINT;
|
|
250
|
+
var isDesktop = viewportWidth >= DESKTOP_BREAKPOINT;
|
|
251
|
+
|
|
252
|
+
// Default all display properties to true if not explicitly set
|
|
253
|
+
var mobiledisplay = column.mobiledisplay !== false;
|
|
254
|
+
var tabletdisplay = column.tabletdisplay !== false;
|
|
255
|
+
var pcdisplay = column.pcdisplay !== false;
|
|
256
|
+
|
|
257
|
+
// Check visibility based on device type
|
|
258
|
+
if (isMobile && !mobiledisplay) {
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
if (isTablet && !tabletdisplay) {
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
if (isDesktop && !pcdisplay) {
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
return true;
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
// Children parsing utilities
|
|
271
|
+
var parseTableColumns = exports.parseTableColumns = function parseTableColumns(children) {
|
|
272
|
+
var columns = [];
|
|
273
|
+
_react["default"].Children.forEach(children, function (child) {
|
|
274
|
+
if (child && child.props && child.props.name && child.props.name.includes("wm_table_column")) {
|
|
275
|
+
var props = (0, _lodashEs.get)(child, "props", {});
|
|
276
|
+
columns.push(_objectSpread({
|
|
277
|
+
field: (0, _lodashEs.get)(props, "binding"),
|
|
278
|
+
caption: (0, _lodashEs.get)(props, "caption"),
|
|
279
|
+
displayName: (0, _lodashEs.get)(props, "caption"),
|
|
280
|
+
show: (0, _lodashEs.get)(props, "show", true) !== false,
|
|
281
|
+
sortable: (0, _lodashEs.get)(props, "sortable", true) !== false,
|
|
282
|
+
textalignment: (0, _lodashEs.get)(props, "textalignment", "left"),
|
|
283
|
+
backgroundcolor: (0, _lodashEs.get)(props, "backgroundcolor"),
|
|
284
|
+
textcolor: (0, _lodashEs.get)(props, "textcolor"),
|
|
285
|
+
width: (0, _lodashEs.get)(props, "width"),
|
|
286
|
+
editWidgetType: (0, _lodashEs.get)(props, "editWidgetType", "WmText"),
|
|
287
|
+
widgetType: (0, _lodashEs.get)(props, "widgetType", "label"),
|
|
288
|
+
required: (0, _lodashEs.get)(props, "required") === true || (0, _lodashEs.get)(props, "required") === "true",
|
|
289
|
+
defaultvalue: (0, _lodashEs.get)(props, "defaultvalue"),
|
|
290
|
+
disabled: (0, _lodashEs.get)(props, "disabled") === true || (0, _lodashEs.get)(props, "disabled") === "true",
|
|
291
|
+
placeholder: (0, _lodashEs.get)(props, "placeholder"),
|
|
292
|
+
sortby: (0, _lodashEs.get)(props, "sortby")
|
|
293
|
+
}, props));
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
return columns;
|
|
297
|
+
};
|
|
298
|
+
var parseTableRowActions = exports.parseTableRowActions = function parseTableRowActions(children) {
|
|
299
|
+
var actions = [];
|
|
300
|
+
_react["default"].Children.forEach(children, function (child) {
|
|
301
|
+
if (child && child.props && child.props.name && child.props.name.includes("wm_table_row_action")) {
|
|
302
|
+
var props = (0, _lodashEs.get)(child, "props", {});
|
|
303
|
+
var actionProps = (0, _lodashEs.assign)({}, props);
|
|
304
|
+
if (child.key) {
|
|
305
|
+
actionProps.key = child.key;
|
|
306
|
+
}
|
|
307
|
+
actions.push(actionProps);
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
return actions;
|
|
311
|
+
};
|
|
312
|
+
var parseTableActions = exports.parseTableActions = function parseTableActions(children) {
|
|
313
|
+
var actions = [];
|
|
314
|
+
_react["default"].Children.forEach(children, function (child) {
|
|
315
|
+
if (child && child.props && child.props.name && child.props.name.includes("wm_table_action")) {
|
|
316
|
+
var props = (0, _lodashEs.get)(child, "props", {});
|
|
317
|
+
var actionProps = (0, _lodashEs.assign)({}, props);
|
|
318
|
+
if (child.key) {
|
|
319
|
+
actionProps.key = child.key;
|
|
320
|
+
}
|
|
321
|
+
actions.push(actionProps);
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
return actions;
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
// Parse WmTableRow component for row expansion
|
|
328
|
+
var parseTableRowExpansion = exports.parseTableRowExpansion = function parseTableRowExpansion(children) {
|
|
329
|
+
var rowExpansionConfig = null;
|
|
330
|
+
_react["default"].Children.forEach(children, function (child) {
|
|
331
|
+
if (child && child.type && child.type.displayName === "WmTableRow") {
|
|
332
|
+
// Check by displayName to ensure we get the right component
|
|
333
|
+
var props = (0, _lodashEs.get)(child, "props", {});
|
|
334
|
+
rowExpansionConfig = props;
|
|
335
|
+
} else if (child && child.props && child.props.name) {
|
|
336
|
+
// Fallback: check by name but ensure it's not a row action
|
|
337
|
+
var name = child.props.name;
|
|
338
|
+
// Match names that start with "wm_table_row_" followed by a hash/id, but not "wm_table_row_action"
|
|
339
|
+
if (name.startsWith("wm_table_row_") && !name.includes("_action")) {
|
|
340
|
+
var _props = (0, _lodashEs.get)(child, "props", {});
|
|
341
|
+
rowExpansionConfig = _props;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
return rowExpansionConfig;
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
// Action type checking utilities
|
|
349
|
+
var isEditAction = exports.isEditAction = function isEditAction(actionKey) {
|
|
350
|
+
return actionKey === "updaterow";
|
|
351
|
+
};
|
|
352
|
+
var isDeleteAction = exports.isDeleteAction = function isDeleteAction(actionKey) {
|
|
353
|
+
return actionKey === "deleterow";
|
|
354
|
+
};
|
|
355
|
+
var isAddNewAction = exports.isAddNewAction = function isAddNewAction(actionKey) {
|
|
356
|
+
return actionKey === "addNewRow";
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
// CSS class utilities
|
|
360
|
+
var getActionButtonClass = exports.getActionButtonClass = function getActionButtonClass(action) {
|
|
361
|
+
var actionKey = (0, _lodashEs.get)(action, "key") || (0, _lodashEs.get)(action, "name") || (0, _lodashEs.get)(action, "action");
|
|
362
|
+
if (isEditAction(actionKey)) {
|
|
363
|
+
return "row-action row-action-button btn-transparent edit edit-row-button";
|
|
364
|
+
}
|
|
365
|
+
if (isDeleteAction(actionKey) || actionKey === "delete") {
|
|
366
|
+
return "row-action row-action-button btn-transparent delete delete-row-button ".concat(_constants.TABLE_CSS_CLASSES.deleteRow);
|
|
367
|
+
}
|
|
368
|
+
return "row-action row-action-button ".concat((0, _lodashEs.get)(action, "className", "btn-transparent"));
|
|
369
|
+
};
|
|
370
|
+
var getTableActionButtonClass = exports.getTableActionButtonClass = function getTableActionButtonClass(action) {
|
|
371
|
+
return "btn ".concat((0, _lodashEs.get)(action, "className", "btn-primary"), " ").concat(isAddNewAction((0, _lodashEs.get)(action, "key")) ? "add-action" : "");
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
// Validation utilities for edit modes
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Validates editing fields and focuses first invalid field if validation fails
|
|
378
|
+
* Can be used across different edit modes (inline, dialog, quick edit)
|
|
379
|
+
*
|
|
380
|
+
* @param fieldRefs - Record of field references from editing form
|
|
381
|
+
* @param editingRowId - Optional ID for logging/debugging purposes
|
|
382
|
+
* @returns ValidationResult object with validation status and invalid elements
|
|
383
|
+
*/
|
|
384
|
+
var validateEditingFields = exports.validateEditingFields = function validateEditingFields(fieldRefs, editingRowId) {
|
|
385
|
+
var invalidElements = [];
|
|
386
|
+
var invalidFieldKeys = [];
|
|
387
|
+
|
|
388
|
+
// Helper to determine if a field needs validation based on the rowId prefix
|
|
389
|
+
var shouldValidateField = function shouldValidateField(fieldKey) {
|
|
390
|
+
if (!editingRowId) return true; // Validate all if no rowId provided
|
|
391
|
+
return (0, _lodashEs.startsWith)(fieldKey, "".concat(editingRowId, "_"));
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
// Check each field reference for validity
|
|
395
|
+
(0, _lodashEs.forEach)((0, _lodashEs.entries)(fieldRefs), function (_ref) {
|
|
396
|
+
var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
|
|
397
|
+
fieldKey = _ref2[0],
|
|
398
|
+
fieldElement = _ref2[1];
|
|
399
|
+
// Skip fields that don't belong to the current editing row
|
|
400
|
+
if (!shouldValidateField(fieldKey) || !fieldElement) {
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
var isInvalid = false;
|
|
404
|
+
|
|
405
|
+
// First check for HTML5 validation
|
|
406
|
+
var inputs = fieldElement.querySelectorAll("input, select, textarea");
|
|
407
|
+
(0, _lodashEs.forEach)(inputs, function (input) {
|
|
408
|
+
// Check HTML5 validation
|
|
409
|
+
if (input && !input.validity.valid) {
|
|
410
|
+
invalidElements.push(input);
|
|
411
|
+
isInvalid = true;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// Check for custom validation classes
|
|
415
|
+
if (input && input.classList.contains("ng-invalid")) {
|
|
416
|
+
invalidElements.push(input);
|
|
417
|
+
isInvalid = true;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
// Check for required fields that are empty
|
|
421
|
+
if (input && input.hasAttribute("required") && !(0, _lodashEs.trim)(input.value)) {
|
|
422
|
+
invalidElements.push(input);
|
|
423
|
+
isInvalid = true;
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
// Then check for "required" attribute on the field element itself
|
|
428
|
+
if (fieldElement.hasAttribute("required")) {
|
|
429
|
+
var inputEl = fieldElement.querySelector("input, textarea, select");
|
|
430
|
+
if (inputEl && !(0, _lodashEs.trim)(inputEl.value)) {
|
|
431
|
+
invalidElements.push(inputEl);
|
|
432
|
+
isInvalid = true;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
if (isInvalid) {
|
|
436
|
+
invalidFieldKeys.push(fieldKey);
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
// If invalid elements found, focus the first one
|
|
441
|
+
if ((0, _lodashEs.size)(invalidElements) > 0) {
|
|
442
|
+
var logPrefix = editingRowId ? "[".concat(editingRowId, "]") : "[Validation]";
|
|
443
|
+
console.log("".concat(logPrefix, " Validation failed: Found ").concat((0, _lodashEs.size)(invalidElements), " invalid elements"));
|
|
444
|
+
|
|
445
|
+
// Focus the first invalid element
|
|
446
|
+
var firstInvalidElement = (0, _lodashEs.get)(invalidElements, "[0]");
|
|
447
|
+
if (firstInvalidElement) {
|
|
448
|
+
// Find the closest container cell
|
|
449
|
+
var cell = firstInvalidElement.closest("td, .app-datagrid-cell, .form-field");
|
|
450
|
+
if (cell) {
|
|
451
|
+
// Try to find a specific focus-target, or fallback to the input itself
|
|
452
|
+
var focusTarget = cell.querySelector("[focus-target], input, textarea, select");
|
|
453
|
+
if (focusTarget) {
|
|
454
|
+
setTimeout(function () {
|
|
455
|
+
focusTarget.focus();
|
|
456
|
+
console.log("".concat(logPrefix, " Focused first invalid field:"), focusTarget);
|
|
457
|
+
}, 0);
|
|
458
|
+
}
|
|
459
|
+
} else {
|
|
460
|
+
// If we can't find a container, try to focus the element directly
|
|
461
|
+
setTimeout(function () {
|
|
462
|
+
firstInvalidElement.focus();
|
|
463
|
+
}, 0);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
return {
|
|
468
|
+
isValid: (0, _lodashEs.isEmpty)(invalidElements),
|
|
469
|
+
invalidElements: invalidElements,
|
|
470
|
+
invalidFieldKeys: invalidFieldKeys,
|
|
471
|
+
firstInvalidElement: (0, _lodashEs.size)(invalidElements) > 0 ? (0, _lodashEs.get)(invalidElements, "[0]") : undefined
|
|
472
|
+
};
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
// Panel and button styling utilities
|
|
476
|
+
var getButtonClasses = exports.getButtonClasses = function getButtonClasses(action) {
|
|
477
|
+
var spacing = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "normal";
|
|
478
|
+
var isGridEditMode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
479
|
+
var isLoading = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
480
|
+
var baseClass = "btn ".concat((0, _lodashEs.get)(action, "className", "btn-primary"), " ").concat(isAddNewAction((0, _lodashEs.get)(action, "key")) ? "add-action" : "");
|
|
481
|
+
var spacingClass = spacing === "condensed" ? "btn-sm" : "";
|
|
482
|
+
var disabledClass = (0, _lodashEs.get)(action, "key") === "addNewRow" && (isGridEditMode || isLoading) ? "disabled-new" : "";
|
|
483
|
+
return (0, _lodashEs.trim)("".concat(baseClass, " ").concat(spacingClass, " ").concat(disabledClass));
|
|
484
|
+
};
|
|
485
|
+
var getSpacingClasses = exports.getSpacingClasses = function getSpacingClasses() {
|
|
486
|
+
var spacing = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "normal";
|
|
487
|
+
var classes = [];
|
|
488
|
+
if (spacing === "condensed") {
|
|
489
|
+
classes.push("table-condensed");
|
|
490
|
+
}
|
|
491
|
+
return classes.join(" ");
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
// Pagination display logic
|
|
495
|
+
var shouldShowPagination = exports.shouldShowPagination = function shouldShowPagination(_ref3) {
|
|
496
|
+
var _datasource$paginatio;
|
|
497
|
+
var shownavigation = _ref3.shownavigation,
|
|
498
|
+
onDemandLoad = _ref3.onDemandLoad,
|
|
499
|
+
internalDataset = _ref3.internalDataset,
|
|
500
|
+
pagesize = _ref3.pagesize,
|
|
501
|
+
allowpagesizechange = _ref3.allowpagesizechange,
|
|
502
|
+
datasource = _ref3.datasource;
|
|
503
|
+
// If shownavigation is false, don't show pagination
|
|
504
|
+
if (!shownavigation) return false;
|
|
505
|
+
|
|
506
|
+
// If datasource has pagination metadata, show pagination
|
|
507
|
+
if ((datasource === null || datasource === void 0 || (_datasource$paginatio = datasource.pagination) === null || _datasource$paginatio === void 0 ? void 0 : _datasource$paginatio.totalElements) > 0) return true;
|
|
508
|
+
|
|
509
|
+
// If allowpagesizechange is true, always show pagination
|
|
510
|
+
if (allowpagesizechange) return true;
|
|
511
|
+
|
|
512
|
+
// If using on-demand load or if dataset is larger than page size, show pagination
|
|
513
|
+
return onDemandLoad || (0, _lodashEs.size)(internalDataset) > pagesize;
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
// Panel structure utilities
|
|
517
|
+
var shouldShowPanelHeading = exports.shouldShowPanelHeading = function shouldShowPanelHeading(title, subheading, iconclass) {
|
|
518
|
+
var exportOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
519
|
+
var headerActions = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
|
|
520
|
+
return !(0, _lodashEs.isEmpty)(title) || !(0, _lodashEs.isEmpty)(subheading) || !(0, _lodashEs.isEmpty)(iconclass) || (0, _lodashEs.size)(exportOptions) > 0 || (0, _lodashEs.size)(headerActions) > 0;
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* Utility function to handle navigation after a new row is added to the table
|
|
525
|
+
* Used by both inline edit and quick edit modes
|
|
526
|
+
*/
|
|
527
|
+
var handleNewRowNavigation = exports.handleNewRowNavigation = function handleNewRowNavigation(tableRef, newRecord, internalDataset) {
|
|
528
|
+
if (!(0, _lodashEs.get)(tableRef, "current")) return;
|
|
529
|
+
var table = (0, _lodashEs.get)(tableRef, "current");
|
|
530
|
+
var sortingState = (0, _lodashEs.get)(table.getState(), "sorting");
|
|
531
|
+
var hasSorting = sortingState && (0, _lodashEs.size)(sortingState) > 0;
|
|
532
|
+
if (hasSorting) {
|
|
533
|
+
// If sorting is active, find where the new record ends up
|
|
534
|
+
setTimeout(function () {
|
|
535
|
+
var sortedRows = (0, _lodashEs.get)(table.getSortedRowModel(), "rows", []);
|
|
536
|
+
var newRecordIndex = (0, _lodashEs.findIndex)(sortedRows, function (row) {
|
|
537
|
+
return (0, _lodashEs.get)(row, "original._wmTableRowId") === (0, _lodashEs.get)(newRecord, "_wmTableRowId");
|
|
538
|
+
});
|
|
539
|
+
if (newRecordIndex !== -1) {
|
|
540
|
+
var currentPageSize = (0, _lodashEs.get)(table.getState(), "pagination.pageSize");
|
|
541
|
+
var targetPage = (0, _lodashEs.floor)(newRecordIndex / currentPageSize);
|
|
542
|
+
table.setPageIndex(targetPage);
|
|
543
|
+
}
|
|
544
|
+
}, 0);
|
|
545
|
+
} else {
|
|
546
|
+
// If no sorting, navigate to the last page
|
|
547
|
+
var currentPageSize = (0, _lodashEs.get)(table.getState(), "pagination.pageSize");
|
|
548
|
+
// Add 1 because the new record hasn't been added to internalDataset state yet
|
|
549
|
+
var newDatasetLength = (0, _lodashEs.size)(internalDataset) + 1;
|
|
550
|
+
var totalPages = (0, _lodashEs.ceil)(newDatasetLength / currentPageSize);
|
|
551
|
+
table.setPageIndex((0, _lodashEs.max)([0, totalPages - 1]));
|
|
552
|
+
}
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* List of internal properties that should be removed from row data
|
|
557
|
+
* before passing to external handlers
|
|
558
|
+
*/
|
|
559
|
+
var INTERNAL_PROPERTIES = exports.INTERNAL_PROPERTIES = ["_wmTableRowId" // Internal row identifier
|
|
560
|
+
];
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Cleans row data by removing internal properties
|
|
564
|
+
* Handles both single objects and arrays of objects
|
|
565
|
+
* @param data The raw data - can be a single object, array of objects, or primitive
|
|
566
|
+
* @returns The cleaned data without internal properties
|
|
567
|
+
*/
|
|
568
|
+
var cleanRowData = exports.cleanRowData = function cleanRowData(data) {
|
|
569
|
+
if (!data) return data;
|
|
570
|
+
|
|
571
|
+
// For arrays, clean each item
|
|
572
|
+
if ((0, _lodashEs.isArray)(data)) {
|
|
573
|
+
return data.map(function (item) {
|
|
574
|
+
return cleanRowData(item);
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
// For objects, remove internal properties
|
|
579
|
+
if ((0, _typeof2["default"])(data) === "object") {
|
|
580
|
+
return (0, _lodashEs.omit)(data, INTERNAL_PROPERTIES);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
// For primitive types, return as is
|
|
584
|
+
return data;
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
// Helper function to parse width values
|
|
588
|
+
var parseWidth = exports.parseWidth = function parseWidth(width) {
|
|
589
|
+
var fallbackSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 150;
|
|
590
|
+
var columnSize = fallbackSize;
|
|
591
|
+
var styleWidth = width;
|
|
592
|
+
if (typeof styleWidth === "string") {
|
|
593
|
+
// Convert percentage to a pixel value (assuming viewport width)
|
|
594
|
+
if (styleWidth.endsWith("%")) {
|
|
595
|
+
var percentage = parseFloat(styleWidth);
|
|
596
|
+
// Use a base width of 1200px for percentage calculations
|
|
597
|
+
columnSize = Math.round(percentage / 100 * 1200);
|
|
598
|
+
} else if (styleWidth.endsWith("px")) {
|
|
599
|
+
columnSize = parseInt(styleWidth);
|
|
600
|
+
} else {
|
|
601
|
+
columnSize = parseInt(styleWidth);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
return columnSize;
|
|
605
|
+
};
|
|
606
|
+
|
|
607
|
+
// Export utilities
|