@wavemaker/react-runtime 11.14.2-rc.6311 → 11.15.0-1.246
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 +5 -7
- package/actions/login-action.js +7 -8
- package/actions/logout-action.js +5 -7
- package/actions/navigation-action.js +73 -18
- package/actions/notification-action.js +22 -8
- package/actions/timer-action.js +13 -15
- package/actions/toast.js +4 -2
- package/actions/toast.service.js +1 -2
- package/components/advanced/carousel/index.js +1 -1
- package/components/advanced/carousel/template.js +1 -1
- package/components/basic/anchor/index.js +31 -11
- package/components/basic/html/index.js +115 -24
- package/components/basic/icon/index.js +2 -1
- package/components/basic/iframe/index.js +2 -1
- package/components/basic/label/index.js +12 -9
- package/components/basic/message/index.js +12 -3
- package/components/basic/picture/index.js +11 -4
- package/components/basic/progress-bar/index.js +4 -1
- package/components/basic/progress-circle/index.js +34 -28
- package/components/basic/progress-circle/props.js +10 -2
- package/components/basic/richtexteditor/index.js +95 -94
- package/components/basic/search/index.js +401 -156
- package/components/basic/search/providers.js +126 -61
- package/components/basic/spinner/index.js +2 -1
- package/components/basic/tree/index.js +34 -34
- package/components/basic/tree/utils.js +10 -4
- package/components/chart/components/barColumnChart/index.js +36 -33
- package/components/chart/components/bubbleChart/index.js +35 -25
- package/components/chart/components/chartLegend/utils.js +2 -1
- package/components/chart/components/cumulativeLineChart/index.js +30 -26
- package/components/chart/components/lineAreaChart/index.js +50 -32
- package/components/chart/components/pieDonutChart/index.js +13 -4
- package/components/chart/hooks/useXAxisConfig.js +15 -8
- package/components/chart/index.js +223 -53
- package/components/chart/utils.js +12 -1
- package/components/constants.js +5 -2
- package/components/container/accordion/accordion-pane/index.js +17 -12
- package/components/container/accordion/index.js +9 -4
- package/components/container/alignment-utils.js +56 -1
- package/components/container/index.js +49 -20
- package/components/container/panel/components/panel-header/index.js +3 -4
- package/components/container/panel/index.js +15 -10
- package/components/container/repeat-template/index.js +33 -0
- package/components/container/tabs/index.js +83 -14
- package/components/container/tabs/tab-pane/index.js +33 -10
- package/components/container/tabs/utils.js +51 -0
- package/components/container/wizard/components/StepComponents.js +2 -1
- package/components/container/wizard/components/WizardStep.js +2 -1
- package/components/container/wizard/index.js +64 -35
- package/components/container/wizard/utils.js +46 -1
- package/components/container/wizard/wizard-step/index.js +11 -1
- package/components/data/card/card-content/index.js +1 -1
- package/components/data/form/base-form/index.js +985 -183
- package/components/data/form/base-form/props.js +3 -1
- package/components/data/form/base-form/utils.js +159 -1
- package/components/data/form/dynamic-fields/constant.js +53 -0
- package/components/data/form/dynamic-fields/index.js +10 -45
- package/components/data/form/dynamic-fields/utils.js +37 -2
- package/components/data/form/form-action/index.js +5 -4
- package/components/data/form/form-context.js +5 -1
- package/components/data/form/form-controller/utils.js +84 -0
- package/components/data/form/form-controller/validation-contrustor.js +402 -189
- package/components/data/form/form-controller/withFormController.js +191 -52
- package/components/data/form/form-field/base-field.js +67 -45
- package/components/data/form/form-field/index.js +28 -5
- package/components/data/form/form-header/index.js +3 -4
- package/components/data/form/index.js +20 -1
- package/components/data/list/components/ListDND.js +2 -1
- package/components/data/list/components/ListItem.js +6 -2
- package/components/data/list/components/ListItemWithTemplate.js +46 -2
- package/components/data/list/components/ListItems.js +17 -26
- package/components/data/list/components/ListPagination.js +3 -3
- package/components/data/list/components/StandardListItems.js +3 -4
- package/components/data/list/hooks/useListEffects.js +55 -14
- package/components/data/list/hooks/useListEventHandlers.js +3 -1
- package/components/data/list/hooks/useListState.js +3 -1
- package/components/data/list/hooks/usePaginatedGroupedData.js +18 -5
- package/components/data/list/index.js +74 -55
- package/components/data/list/utils/list-helpers.js +73 -35
- package/components/data/list/utils/list-widget-methods.js +138 -95
- package/components/data/live-filter/index.js +26 -15
- package/components/data/live-form/index.js +51 -18
- package/components/data/live-form/props.js +1 -1
- package/components/data/pagination/components/BasicPagination.js +71 -16
- package/components/data/pagination/components/PageSizeSelector.js +8 -3
- package/components/data/pagination/components/TotalRecords.js +1 -5
- package/components/data/pagination/hooks/usePagination.js +349 -66
- package/components/data/pagination/index.js +137 -19
- package/components/data/table/components/AddNewRow.js +5 -1
- package/components/data/table/components/EditableCell.js +2 -2
- package/components/data/table/components/RowCells.js +64 -0
- package/components/data/table/components/RowExpansionButton.js +2 -2
- package/components/data/table/components/SummaryCell.js +111 -0
- package/components/data/table/components/SummaryRow.js +54 -0
- package/components/data/table/components/SummaryRowFooter.js +46 -0
- package/components/data/table/components/TableBody.js +61 -59
- package/components/data/table/components/TableDataRow.js +109 -0
- package/components/data/table/components/TableFilters.js +225 -121
- package/components/data/table/components/TableHeader.js +291 -23
- package/components/data/table/components/TablePanelHeading.js +139 -8
- package/components/data/table/components/index.js +22 -1
- package/components/data/table/hooks/use-edited-rows.js +141 -0
- package/components/data/table/hooks/useCellState.js +5 -12
- package/components/data/table/hooks/useFormWidget.js +58 -52
- package/components/data/table/hooks/usePaginationState.js +45 -24
- package/components/data/table/hooks/usePanelStructure.js +4 -4
- package/components/data/table/hooks/useRowHandlers.js +39 -5
- package/components/data/table/hooks/useRowSelection.js +244 -50
- package/components/data/table/hooks/useServerSideSorting.js +81 -37
- package/components/data/table/hooks/useTableColumns.js +211 -118
- package/components/data/table/hooks/useTableData.js +54 -9
- package/components/data/table/hooks/useTableEdit.js +272 -97
- package/components/data/table/hooks/useTableEffects.js +31 -13
- package/components/data/table/hooks/useTableFilter.js +1 -1
- package/components/data/table/hooks/useTableInitialization.js +23 -22
- package/components/data/table/hooks/useTableState.js +11 -5
- package/components/data/table/hooks/useTableStateManager.js +140 -65
- package/components/data/table/index.js +637 -274
- package/components/data/table/live-table/index.js +54 -22
- package/components/data/table/table-action/index.js +1 -1
- package/components/data/table/table-group/index.js +26 -0
- package/components/data/table/table-row-action/index.js +32 -18
- package/components/data/table/utils/buildSelectionColumns.js +12 -21
- package/components/data/table/utils/columnBuilder.js +29 -14
- package/components/data/table/utils/columnProxy.js +68 -1
- package/components/data/table/utils/constants.js +6 -2
- package/components/data/table/utils/crud-handlers.js +68 -63
- package/components/data/table/utils/groupHeaderUtils.js +102 -0
- package/components/data/table/utils/index.js +210 -21
- package/components/data/table/utils/renderDisplayCell.js +6 -6
- package/components/data/table/utils/selectionUtils.js +25 -26
- package/components/data/table/utils/validation.js +1 -0
- package/components/data/utils/filter-field-util.js +3 -3
- package/components/dialogs/alert-dialog/index.js +1 -1
- package/components/dialogs/confirm-dialog/index.js +1 -1
- package/components/dialogs/dialog/index.js +4 -1
- package/components/dialogs/dialog-content/index.js +3 -1
- package/components/dialogs/dialog-header/index.js +2 -2
- package/components/dialogs/iframe-dialog/index.js +11 -5
- package/components/dialogs/index.js +1 -1
- package/components/dialogs/login-dialog/index.js +1 -1
- package/components/dialogs/page-dialog/index.js +1 -1
- package/components/form/button/index.js +33 -7
- package/components/input/calendar/index.js +18 -6
- package/components/input/chips/index.js +99 -28
- package/components/input/chips/utils.js +34 -4
- package/components/input/color-picker/index.js +74 -25
- package/components/input/composite/index.js +3 -3
- package/components/input/currency/index.js +35 -49
- package/components/input/default/checkbox/index.js +23 -28
- package/components/input/default/checkboxset/index.js +38 -18
- package/components/input/default/checkboxset/utils.js +30 -0
- package/components/input/default/radioset/index.js +36 -39
- package/components/input/default/switch/index.js +30 -13
- package/components/input/epoch/date/index.js +130 -69
- package/components/input/epoch/date/utils.js +94 -1
- package/components/input/epoch/datetime/index.js +72 -22
- package/components/input/epoch/datetime/utils.js +49 -10
- package/components/input/epoch/time/index.js +68 -19
- package/components/input/epoch/time/utils.js +62 -14
- package/components/input/fileupload/Utils.js +12 -7
- package/components/input/fileupload/components/MultiUpload.js +2 -6
- package/components/input/fileupload/components/SingleUpload.js +3 -7
- package/components/input/fileupload/index.js +6 -10
- package/components/input/fileupload/useFileUpload.js +16 -5
- package/components/input/number/index.js +158 -43
- package/components/input/rating/index.js +90 -7
- package/components/input/select/index.js +209 -72
- package/components/input/slider/index.js +84 -26
- package/components/input/text/index.js +38 -18
- package/components/input/text/util.js +283 -130
- package/components/input/textarea/index.js +13 -10
- package/components/input/upload/index.js +124 -0
- package/components/input/upload/props.js +5 -0
- package/components/input/util/index.js +11 -0
- package/components/navbar/index.js +51 -3
- package/components/navbar/nav/index.js +46 -16
- package/components/navbar/nav-item/index.js +11 -5
- package/components/navigation/menu/components/ListItems.js +3 -0
- package/components/navigation/menu/constants.js +2 -1
- package/components/navigation/menu/hooks/useHoverState.hook.js +48 -0
- package/components/navigation/menu/hooks/useKeyboardMovements.hook.js +37 -0
- package/components/navigation/menu/hooks/useTransformedDataset.hook.js +15 -0
- package/components/navigation/menu/index.js +326 -188
- package/components/navigation/menu/utils/action-task.js +14 -0
- package/components/navigation/menu/utils/role-filter.js +76 -0
- package/components/navigation/popover/index.js +105 -32
- package/components/page/partial-container/index.js +34 -5
- package/components/prefab/index.js +2 -4
- package/context/PrefabContext.js +10 -6
- package/context/WidgetProvider.js +30 -31
- package/core/app.service.js +1 -1
- package/core/constants/events.js +57 -1
- package/core/dialog.service.js +1 -2
- package/core/event-notifier.js +1 -2
- package/core/formatter/array-formatters.js +33 -0
- package/core/formatter/date-formatters.js +2 -4
- package/core/formatter/index.js +2 -1
- package/core/formatter/number-formatters.js +5 -10
- package/core/formatter/security-formatters.js +2 -4
- package/core/formatter/string-formatters.js +3 -6
- package/core/proxy-service.js +85 -13
- package/core/script-registry.js +108 -48
- package/core/util/common.js +4 -4
- package/core/util/compare.js +30 -0
- package/core/util/dom.js +8 -8
- package/core/util/index.js +16 -6
- package/core/util/safe-is-equal.js +156 -0
- package/core/util/security.js +1 -2
- package/core/util/utils.js +16 -7
- package/higherOrder/BaseApp.js +108 -65
- package/higherOrder/BaseDateTime.js +31 -13
- package/higherOrder/BasePage.js +268 -144
- package/higherOrder/BasePartial.js +1 -1
- package/higherOrder/BasePrefab.js +33 -15
- package/higherOrder/DataNav.js +99 -16
- package/higherOrder/helper.js +41 -3
- package/higherOrder/withBaseWrapper.js +41 -28
- package/hooks/useAuth.js +11 -5
- package/hooks/useHttp.js +280 -94
- package/mui-config/theme-provider.js +1 -1
- package/mui-config/theme.js +1 -1
- package/package-lock.json +840 -740
- package/package.json +8 -8
- package/store/bindActions/i18nActions.js +18 -0
- package/store/index.js +3 -1
- package/store/slices/appConfigSlice.js +2 -2
- package/store/slices/authSlice.js +31 -28
- package/store/slices/i18nSlice.js +2 -2
- package/store/slices/navigationSlice.js +35 -0
- package/store/viewport.service.js +255 -0
- package/utils/attr.js +35 -0
- package/utils/dataset-util.js +1 -2
- package/utils/form-state.util.js +43 -12
- package/utils/form-utils.js +47 -2
- package/utils/format-util.js +28 -13
- package/utils/page-params-util.js +33 -1
- package/utils/state-persistance.js +72 -13
- package/utils/transformedDataset-utils.js +35 -24
- package/variables/base-variable.js +12 -14
- package/variables/crud-variable.js +225 -0
- package/variables/live-variable.js +56 -20
- package/variables/metadata.service.js +123 -0
- package/variables/model-variable.js +21 -15
- package/variables/service-variable.js +88 -83
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
12
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
@@ -51,7 +52,13 @@ var WmPagination = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
51
52
|
isLoadingMore = props.isLoadingMore,
|
|
52
53
|
setIsLoadingMore = props.setIsLoadingMore,
|
|
53
54
|
isServerSidePagination = props.isServerSidePagination,
|
|
54
|
-
onDataUpdate = props.onDataUpdate
|
|
55
|
+
onDataUpdate = props.onDataUpdate,
|
|
56
|
+
_props$ondemandmessag = props.ondemandmessage,
|
|
57
|
+
ondemandmessage = _props$ondemandmessag === void 0 ? "Load More" : _props$ondemandmessag,
|
|
58
|
+
_props$viewlessmessag = props.viewlessmessage,
|
|
59
|
+
viewlessmessage = _props$viewlessmessag === void 0 ? "View Less" : _props$viewlessmessag,
|
|
60
|
+
_props$showviewlessbu = props.showviewlessbutton,
|
|
61
|
+
showviewlessbutton = _props$showviewlessbu === void 0 ? false : _props$showviewlessbu;
|
|
55
62
|
|
|
56
63
|
// Custom hooks for pagination logic and navigation sizing
|
|
57
64
|
var pagination = (0, _hooks.usePagination)({
|
|
@@ -73,10 +80,11 @@ var WmPagination = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
73
80
|
datasourceInvokeOptions: props.datasourceInvokeOptions
|
|
74
81
|
});
|
|
75
82
|
|
|
76
|
-
// Notify parent component when data changes in Scroll mode
|
|
83
|
+
// Notify parent component when data changes in Scroll or On-Demand mode
|
|
77
84
|
var prevResultLengthRef = _react["default"].useRef(0);
|
|
78
85
|
_react["default"].useEffect(function () {
|
|
79
|
-
|
|
86
|
+
var isAccumulatingMode = navigation === "Scroll" || navigation === "On-Demand";
|
|
87
|
+
if (isAccumulatingMode && onDataUpdate && pagination.result) {
|
|
80
88
|
// Only update if the result length has changed (new data added)
|
|
81
89
|
if (pagination.result.length !== prevResultLengthRef.current) {
|
|
82
90
|
prevResultLengthRef.current = pagination.result.length;
|
|
@@ -90,6 +98,36 @@ var WmPagination = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
90
98
|
}),
|
|
91
99
|
navigationClass = _useNavigationSize.navigationClass;
|
|
92
100
|
|
|
101
|
+
// Attach dataNavigator API to pagination widget proxy (like Angular's @ViewChild)
|
|
102
|
+
// Update properties every render so they stay current (like Angular component instance)
|
|
103
|
+
(0, _react.useEffect)(function () {
|
|
104
|
+
var _listener$Widgets, _listener$Widgets2, _props$onPaginationWi;
|
|
105
|
+
if (!name || !(listener !== null && listener !== void 0 && (_listener$Widgets = listener.Widgets) !== null && _listener$Widgets !== void 0 && _listener$Widgets[name])) return;
|
|
106
|
+
var paginationWidget = listener === null || listener === void 0 || (_listener$Widgets2 = listener.Widgets) === null || _listener$Widgets2 === void 0 ? void 0 : _listener$Widgets2[name];
|
|
107
|
+
|
|
108
|
+
// Spread entire pagination object to avoid manual property copying
|
|
109
|
+
// This includes: currentPage, pageCount, dataSize, result, navigatePage, etc.
|
|
110
|
+
Object.assign(paginationWidget, pagination, {
|
|
111
|
+
// Add convenience navigation methods
|
|
112
|
+
goToFirstPage: function goToFirstPage() {
|
|
113
|
+
return pagination.navigatePage("first");
|
|
114
|
+
},
|
|
115
|
+
goToLastPage: function goToLastPage() {
|
|
116
|
+
return pagination.navigatePage("last");
|
|
117
|
+
},
|
|
118
|
+
goToNextPage: function goToNextPage() {
|
|
119
|
+
return pagination.navigatePage("next");
|
|
120
|
+
},
|
|
121
|
+
goToPreviousPage: function goToPreviousPage() {
|
|
122
|
+
return pagination.navigatePage("prev");
|
|
123
|
+
},
|
|
124
|
+
actualPageSize: pagination.currentMaxResults
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
// Notify parent once on mount
|
|
128
|
+
props === null || props === void 0 || (_props$onPaginationWi = props.onPaginationWidgetReady) === null || _props$onPaginationWi === void 0 || _props$onPaginationWi.call(props, paginationWidget);
|
|
129
|
+
}, [name, pagination, props === null || props === void 0 ? void 0 : props.onPaginationWidgetReady]);
|
|
130
|
+
|
|
93
131
|
// Memoized flex container styles for better performance
|
|
94
132
|
var flexContainerStyles = (0, _react.useMemo)(function () {
|
|
95
133
|
var baseStyles = {
|
|
@@ -113,7 +151,25 @@ var WmPagination = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
113
151
|
|
|
114
152
|
// Memoized common page size selector
|
|
115
153
|
var pageSizeSelector = (0, _react.useMemo)(function () {
|
|
154
|
+
var _props$paginationMeta;
|
|
116
155
|
if (!allowpagesizechange) return null;
|
|
156
|
+
|
|
157
|
+
// Parse page size options to get the minimum value
|
|
158
|
+
var parsedOptions = pagesizeoptions.split(",").map(function (opt) {
|
|
159
|
+
return parseInt(opt.trim(), 10);
|
|
160
|
+
}).filter(function (opt) {
|
|
161
|
+
return !isNaN(opt);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// Include paginationMeta.size if available
|
|
165
|
+
if ((_props$paginationMeta = props.paginationMeta) !== null && _props$paginationMeta !== void 0 && _props$paginationMeta.size && !parsedOptions.includes(props.paginationMeta.size)) {
|
|
166
|
+
parsedOptions.push(props.paginationMeta.size);
|
|
167
|
+
}
|
|
168
|
+
var minPageSize = parsedOptions.length > 0 ? Math.min.apply(Math, (0, _toConsumableArray2["default"])(parsedOptions)) : 0;
|
|
169
|
+
|
|
170
|
+
// Hide page size selector if total records is less than or equal to the minimum page size
|
|
171
|
+
// since all records are already visible
|
|
172
|
+
if (pagination.dataSize < minPageSize) return null;
|
|
117
173
|
return __jsx(_components.PageSizeSelector, {
|
|
118
174
|
pagesizeoptions: pagesizeoptions,
|
|
119
175
|
maxResults: pagination.currentMaxResults,
|
|
@@ -225,11 +281,6 @@ var WmPagination = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
225
281
|
isDisableNext: pagination.isDisableNext,
|
|
226
282
|
onNavigate: pagination.navigatePage
|
|
227
283
|
}) : null;
|
|
228
|
-
case "Scroll":
|
|
229
|
-
// For scroll navigation, render a sentinel element for intersection observer
|
|
230
|
-
return null;
|
|
231
|
-
// Navigation controls not needed for infinite scroll
|
|
232
|
-
|
|
233
284
|
default:
|
|
234
285
|
return null;
|
|
235
286
|
}
|
|
@@ -237,6 +288,9 @@ var WmPagination = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
237
288
|
|
|
238
289
|
// Simple render function - avoid over-optimization that causes re-renders
|
|
239
290
|
var renderPaginationContent = function renderPaginationContent() {
|
|
291
|
+
if (navigation === "None" || navigation === "Scroll") {
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
240
294
|
var navigationComponent = renderNavigation();
|
|
241
295
|
var content = __jsx(_react["default"].Fragment, null, pageSizeSelector, navigationComponent);
|
|
242
296
|
|
|
@@ -250,8 +304,78 @@ var WmPagination = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
250
304
|
return renderWithLayout(content, recordCountVariant);
|
|
251
305
|
};
|
|
252
306
|
|
|
307
|
+
// Render On-Demand navigation content
|
|
308
|
+
if (pagination.navcontrols === "On-Demand") {
|
|
309
|
+
// Check if there's data to show and it's more than one page worth
|
|
310
|
+
// Don't show navigation if data is empty or already shows all items
|
|
311
|
+
var hasEnoughData = pagination.dataSize > 0 && pagination.dataSize > pagination.currentMaxResults;
|
|
312
|
+
|
|
313
|
+
// Determine if we should show Load More button
|
|
314
|
+
// Only show when there's more data AND accumulated data is less than total
|
|
315
|
+
var shouldShowLoadMore = hasEnoughData && pagination.hasMoreData && pagination.accumulatedDataCount < pagination.dataSize;
|
|
316
|
+
|
|
317
|
+
// Determine if we should show View Less button
|
|
318
|
+
// Show when all data is loaded, showviewlessbutton is true, and more than first page is loaded
|
|
319
|
+
var shouldShowViewLess = hasEnoughData && !pagination.hasMoreData && showviewlessbutton && pagination.accumulatedDataCount > pagination.currentMaxResults;
|
|
320
|
+
|
|
321
|
+
// Determine which button to show (if any)
|
|
322
|
+
var showButton = shouldShowLoadMore || shouldShowViewLess;
|
|
323
|
+
|
|
324
|
+
// If nothing to show and not loading, return null
|
|
325
|
+
if (!showButton && !pagination.isLoadingMore) {
|
|
326
|
+
return null;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// Determine button properties based on state
|
|
330
|
+
var buttonText = shouldShowViewLess ? viewlessmessage : ondemandmessage;
|
|
331
|
+
var buttonAction = shouldShowViewLess ? pagination.resetAccumulatedData : pagination.loadMoreData;
|
|
332
|
+
return __jsx(_Box["default"], {
|
|
333
|
+
component: "div",
|
|
334
|
+
className: (0, _clsx["default"])("on-demand-datagrid", className),
|
|
335
|
+
sx: _objectSpread({}, styles),
|
|
336
|
+
id: name
|
|
337
|
+
}, pagination.isLoadingMore && __jsx(_Box["default"], {
|
|
338
|
+
component: "div",
|
|
339
|
+
className: "loading-data-msg spin-icon-in-center",
|
|
340
|
+
sx: {
|
|
341
|
+
textAlign: "center",
|
|
342
|
+
padding: "16px"
|
|
343
|
+
}
|
|
344
|
+
}, __jsx(_Box["default"], {
|
|
345
|
+
component: "span"
|
|
346
|
+
}, __jsx(_Box["default"], {
|
|
347
|
+
component: "i",
|
|
348
|
+
className: "app-icon panel-icon fa-spin fa fa-circle-o-notch",
|
|
349
|
+
"aria-hidden": "true"
|
|
350
|
+
}), __jsx(_Box["default"], {
|
|
351
|
+
component: "span",
|
|
352
|
+
className: "sr-only"
|
|
353
|
+
}, "Loading"), __jsx(_Box["default"], {
|
|
354
|
+
component: "span",
|
|
355
|
+
className: "loading-text",
|
|
356
|
+
sx: {
|
|
357
|
+
marginLeft: 1
|
|
358
|
+
}
|
|
359
|
+
}, "Loading..."))), showButton && !pagination.isLoadingMore && __jsx(_Box["default"], {
|
|
360
|
+
component: "a",
|
|
361
|
+
className: "app-button btn btn-block on-demand-load-btn",
|
|
362
|
+
onClick: buttonAction,
|
|
363
|
+
sx: {
|
|
364
|
+
cursor: "pointer",
|
|
365
|
+
display: "block",
|
|
366
|
+
textAlign: "center",
|
|
367
|
+
padding: "10px",
|
|
368
|
+
"&:hover": {
|
|
369
|
+
textDecoration: "none"
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}, buttonText));
|
|
373
|
+
}
|
|
374
|
+
|
|
253
375
|
// Render infinite scroll content
|
|
254
376
|
if (pagination.navcontrols === "Scroll") {
|
|
377
|
+
var _hasEnoughData = pagination.dataSize > 0 && pagination.dataSize > pagination.currentMaxResults;
|
|
378
|
+
var shouldShowViewLessInScroll = _hasEnoughData && !pagination.hasMoreData && showviewlessbutton && pagination.accumulatedDataCount > pagination.currentMaxResults;
|
|
255
379
|
return __jsx(_Box["default"], {
|
|
256
380
|
className: (0, _clsx["default"])("app-datanavigator clearfix", className),
|
|
257
381
|
sx: _objectSpread(_objectSpread({}, styles), {}, {
|
|
@@ -278,17 +402,11 @@ var WmPagination = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
278
402
|
sx: {
|
|
279
403
|
marginLeft: 1
|
|
280
404
|
}
|
|
281
|
-
}, "Loading..."))),
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
padding: 2,
|
|
287
|
-
width: "100%",
|
|
288
|
-
textAlign: "center",
|
|
289
|
-
color: "text.secondary"
|
|
290
|
-
}
|
|
291
|
-
}, __jsx("span", null, "No more data to load")), __jsx(_Box["default"], {
|
|
405
|
+
}, "Loading..."))), shouldShowViewLessInScroll && __jsx(_Box["default"], {
|
|
406
|
+
component: "a",
|
|
407
|
+
className: "app-button btn btn-block on-demand-load-btn",
|
|
408
|
+
onClick: pagination.resetAccumulatedData
|
|
409
|
+
}, viewlessmessage), __jsx(_Box["default"], {
|
|
292
410
|
ref: function ref(el) {
|
|
293
411
|
if (pagination.sentinelRef) {
|
|
294
412
|
pagination.sentinelRef.current = el;
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.AddNewRow = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _material = require("@mui/material");
|
|
10
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
10
11
|
var _lodashEs = require("lodash-es");
|
|
11
12
|
var _tableRowAction = _interopRequireDefault(require("../table-row-action"));
|
|
12
13
|
var __jsx = _react["default"].createElement;
|
|
@@ -165,7 +166,10 @@ var AddNewRow = exports.AddNewRow = function AddNewRow(_ref) {
|
|
|
165
166
|
var widgetType = String(column.editWidgetType || "WmText");
|
|
166
167
|
var editValue = (_ref2 = (_editingRowData$field = editingRowData[fieldName]) !== null && _editingRowData$field !== void 0 ? _editingRowData$field : column.defaultvalue) !== null && _ref2 !== void 0 ? _ref2 : "";
|
|
167
168
|
totalCells.push(__jsx(_material.TableCell, {
|
|
168
|
-
key: "new-row-".concat(fieldName)
|
|
169
|
+
key: "new-row-".concat(fieldName),
|
|
170
|
+
className: (0, _clsx["default"])("app-datagrid-cell cell-editing form-group", {
|
|
171
|
+
"required-field": column.required
|
|
172
|
+
})
|
|
169
173
|
}, column.readonly ? __jsx(_react["default"].Fragment, null) : renderEditableCell(column, fieldName, widgetType, editValue, "new-row")));
|
|
170
174
|
}
|
|
171
175
|
|
|
@@ -70,7 +70,7 @@ var EditableCell = exports.EditableCell = function EditableCell(_ref) {
|
|
|
70
70
|
};
|
|
71
71
|
return __jsx(_material.Box, {
|
|
72
72
|
ref: cellRefCallback,
|
|
73
|
-
onKeyDown: editMode === "quickedit" ? handleKeyDown : undefined,
|
|
73
|
+
onKeyDown: editMode === "quickedit" || editMode === "inline" ? handleKeyDown : undefined,
|
|
74
74
|
"data-field-name": fieldName,
|
|
75
75
|
"data-row-id": rowId
|
|
76
76
|
}, renderFormWidget(fieldName, widgetType, editValue, function (newValue) {
|
|
@@ -85,7 +85,7 @@ var EditableCell = exports.EditableCell = function EditableCell(_ref) {
|
|
|
85
85
|
column: column
|
|
86
86
|
}), showError && __jsx(_FieldValidationError.FieldValidationError, {
|
|
87
87
|
showError: true,
|
|
88
|
-
title: column.required ? "This field is required" : "Field validation failed"
|
|
88
|
+
title: column.validationmessage ? column.validationmessage : column.required ? "This field is required" : "Field validation failed"
|
|
89
89
|
}));
|
|
90
90
|
};
|
|
91
91
|
var _default = exports["default"] = EditableCell;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.RowCells = void 0;
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _material = require("@mui/material");
|
|
13
|
+
var _reactTable = require("@tanstack/react-table");
|
|
14
|
+
var _utils = require("../utils");
|
|
15
|
+
var _excluded = ["className", "textAlign", "backgroundColor"];
|
|
16
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
17
|
+
var __jsx = _react["default"].createElement;
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
// Memoized cell content component to prevent re-renders when activeRowIds changes
|
|
21
|
+
|
|
22
|
+
var RowCells = exports.RowCells = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
23
|
+
var cells = _ref.cells,
|
|
24
|
+
hasExpansion = _ref.hasExpansion,
|
|
25
|
+
expansionInsertIndex = _ref.expansionInsertIndex,
|
|
26
|
+
renderExpansionCell = _ref.renderExpansionCell,
|
|
27
|
+
rowId = _ref.rowId,
|
|
28
|
+
rowData = _ref.rowData,
|
|
29
|
+
isEditingRow = _ref.isEditingRow;
|
|
30
|
+
return __jsx(_react["default"].Fragment, null, cells.map(function (cell, cellIndex) {
|
|
31
|
+
var _cell$column$columnDe, _cell$column, _cell$column$columnDe2, _cell$column$columnDe3, _cell$column$columnDe4, _cell$column$columnDe5, _cell$column$columnDe6, _cell$column$columnDe7;
|
|
32
|
+
var colClassExpression = (cell === null || cell === void 0 || (_cell$column$columnDe = cell.column.columnDef.meta) === null || _cell$column$columnDe === void 0 ? void 0 : _cell$column$columnDe.colClass) || "";
|
|
33
|
+
var columnId = (cell === null || cell === void 0 || (_cell$column = cell.column) === null || _cell$column === void 0 ? void 0 : _cell$column.id) || (cell === null || cell === void 0 || (_cell$column$columnDe2 = cell.column.columnDef) === null || _cell$column$columnDe2 === void 0 ? void 0 : _cell$column$columnDe2.accessorKey) || "";
|
|
34
|
+
var colClass = (0, _utils.getColClass)(colClassExpression, rowData, columnId);
|
|
35
|
+
return __jsx(_react.Fragment, {
|
|
36
|
+
key: "cell-".concat(cellIndex)
|
|
37
|
+
}, hasExpansion && cellIndex === expansionInsertIndex && renderExpansionCell(rowId, rowData), __jsx(_material.TableCell, {
|
|
38
|
+
key: cell.id,
|
|
39
|
+
title: cell.getValue() ? String(cell.getValue()) : "",
|
|
40
|
+
role: "cell",
|
|
41
|
+
tabIndex: 0,
|
|
42
|
+
"data-col-id": cellIndex,
|
|
43
|
+
className: "".concat(_utils.TABLE_CSS_CLASSES.tableCell, " ").concat(colClass || "", " ").concat(((_cell$column$columnDe3 = cell.column.columnDef.meta) === null || _cell$column$columnDe3 === void 0 ? void 0 : _cell$column$columnDe3.className) || "").trim(),
|
|
44
|
+
style: _objectSpread({
|
|
45
|
+
width: cell.column.getSize(),
|
|
46
|
+
textAlign: (_cell$column$columnDe4 = cell.column.columnDef.meta) === null || _cell$column$columnDe4 === void 0 ? void 0 : _cell$column$columnDe4.textAlign,
|
|
47
|
+
backgroundColor: (_cell$column$columnDe5 = cell.column.columnDef.meta) === null || _cell$column$columnDe5 === void 0 ? void 0 : _cell$column$columnDe5.backgroundColor
|
|
48
|
+
}, function () {
|
|
49
|
+
var _ref2 = cell.column.columnDef.meta || {},
|
|
50
|
+
className = _ref2.className,
|
|
51
|
+
textAlign = _ref2.textAlign,
|
|
52
|
+
backgroundColor = _ref2.backgroundColor,
|
|
53
|
+
otherMeta = (0, _objectWithoutProperties2["default"])(_ref2, _excluded);
|
|
54
|
+
return otherMeta;
|
|
55
|
+
}())
|
|
56
|
+
}, (_cell$column$columnDe6 = cell.column.columnDef.meta) !== null && _cell$column$columnDe6 !== void 0 && _cell$column$columnDe6.renderCellContent && !isEditingRow ? (_cell$column$columnDe7 = cell.column.columnDef.meta) === null || _cell$column$columnDe7 === void 0 ? void 0 : _cell$column$columnDe7.renderCellContent(rowData, cell.column.columnDef) : (0, _reactTable.flexRender)(cell.column.columnDef.cell, cell.getContext())));
|
|
57
|
+
}));
|
|
58
|
+
}, function (prevProps, nextProps) {
|
|
59
|
+
// Compare rowData, isEditingRow, and isSelected for rendering updates
|
|
60
|
+
// Note: cells comparison removed to avoid conflicts with external DOM manipulation
|
|
61
|
+
// isSelected is compared to trigger re-renders when selection state changes
|
|
62
|
+
return prevProps.rowData === nextProps.rowData && prevProps.isEditingRow === nextProps.isEditingRow && prevProps.isSelected === nextProps.isSelected;
|
|
63
|
+
});
|
|
64
|
+
RowCells.displayName = "RowCells";
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports["default"] = exports.RowExpansionButton = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _button = _interopRequireDefault(require("
|
|
11
|
-
var _anchor = _interopRequireDefault(require("
|
|
10
|
+
var _button = _interopRequireDefault(require("@wavemaker/react-runtime/components/form/button"));
|
|
11
|
+
var _anchor = _interopRequireDefault(require("@wavemaker/react-runtime/components/basic/anchor"));
|
|
12
12
|
var __jsx = _react["default"].createElement;
|
|
13
13
|
var RowExpansionButton = exports.RowExpansionButton = function RowExpansionButton(_ref) {
|
|
14
14
|
var rowId = _ref.rowId,
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.SummaryCell = void 0;
|
|
9
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _material = require("@mui/material");
|
|
12
|
+
var _utils = require("../utils");
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
14
|
+
var __jsx = _react["default"].createElement;
|
|
15
|
+
/**
|
|
16
|
+
* SummaryCell Component
|
|
17
|
+
* Renders a single cell in the summary row footer.
|
|
18
|
+
* Supports HTML content, custom styling, and Promise loading states.
|
|
19
|
+
*/
|
|
20
|
+
var SummaryCellBase = function SummaryCellBase(_ref) {
|
|
21
|
+
var columnKey = _ref.columnKey,
|
|
22
|
+
column = _ref.column,
|
|
23
|
+
rowDef = _ref.rowDef,
|
|
24
|
+
rowDefObject = _ref.rowDefObject,
|
|
25
|
+
colIndex = _ref.colIndex,
|
|
26
|
+
show = _ref.show;
|
|
27
|
+
// Get the value for this cell
|
|
28
|
+
var columnValue = rowDef[columnKey];
|
|
29
|
+
var columnValueObject = rowDefObject[columnKey];
|
|
30
|
+
|
|
31
|
+
// Extract styling from the value object
|
|
32
|
+
var cellStyling = (0, _react.useMemo)(function () {
|
|
33
|
+
if (columnValueObject && (0, _typeof2["default"])(columnValueObject) === "object" && "class" in columnValueObject) {
|
|
34
|
+
return columnValueObject["class"] || "";
|
|
35
|
+
}
|
|
36
|
+
return "";
|
|
37
|
+
}, [columnValueObject]);
|
|
38
|
+
|
|
39
|
+
// Check if value is a Promise (loading state)
|
|
40
|
+
var isLoading = columnValue instanceof Promise;
|
|
41
|
+
|
|
42
|
+
// Get text alignment from column configuration
|
|
43
|
+
var textAlign = (0, _react.useMemo)(function () {
|
|
44
|
+
return (column === null || column === void 0 ? void 0 : column.textalignment) || "left";
|
|
45
|
+
}, [column]);
|
|
46
|
+
|
|
47
|
+
// Render loading spinner for Promise values
|
|
48
|
+
if (isLoading) {
|
|
49
|
+
return __jsx(_material.TableCell, {
|
|
50
|
+
className: "".concat(_utils.TABLE_CSS_CLASSES.tableCell, " app-datagrid-cell summary-cell ").concat(cellStyling).trim(),
|
|
51
|
+
"data-col-id": colIndex,
|
|
52
|
+
role: "cell",
|
|
53
|
+
tabIndex: 0,
|
|
54
|
+
style: {
|
|
55
|
+
textAlign: textAlign
|
|
56
|
+
}
|
|
57
|
+
}, __jsx(_material.Box, {
|
|
58
|
+
className: "overlay",
|
|
59
|
+
sx: {
|
|
60
|
+
display: "flex",
|
|
61
|
+
justifyContent: "center"
|
|
62
|
+
}
|
|
63
|
+
}, __jsx(_material.CircularProgress, {
|
|
64
|
+
size: 16
|
|
65
|
+
})));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Get display value - handle various formats
|
|
69
|
+
var displayValue = (0, _react.useMemo)(function () {
|
|
70
|
+
if (columnValue === undefined || columnValue === null) {
|
|
71
|
+
return "";
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// If columnValue is an object, extract the value property (safeguard in case setSummaryRowDef didn't extract it)
|
|
75
|
+
if ((0, _typeof2["default"])(columnValue) === "object" && !(columnValue instanceof Promise)) {
|
|
76
|
+
// Check if it's a SummaryRowValue object with a 'value' property
|
|
77
|
+
if ("value" in columnValue) {
|
|
78
|
+
return columnValue.value;
|
|
79
|
+
}
|
|
80
|
+
// If it's an object without 'value', try to stringify it (fallback)
|
|
81
|
+
return String(columnValue);
|
|
82
|
+
}
|
|
83
|
+
return columnValue;
|
|
84
|
+
}, [columnValue]);
|
|
85
|
+
|
|
86
|
+
// Check if value contains HTML (for rendering dangerously)
|
|
87
|
+
var isHtmlContent = (0, _react.useMemo)(function () {
|
|
88
|
+
if (typeof displayValue === "string") {
|
|
89
|
+
return /<[^>]+>/.test(displayValue);
|
|
90
|
+
}
|
|
91
|
+
return false;
|
|
92
|
+
}, [displayValue]);
|
|
93
|
+
return __jsx(_material.TableCell, {
|
|
94
|
+
className: "".concat(_utils.TABLE_CSS_CLASSES.tableCell, " app-datagrid-cell summary-cell ").concat(cellStyling).trim(),
|
|
95
|
+
"data-col-id": colIndex,
|
|
96
|
+
role: "cell",
|
|
97
|
+
tabIndex: 0,
|
|
98
|
+
style: {
|
|
99
|
+
textAlign: textAlign,
|
|
100
|
+
backgroundColor: column === null || column === void 0 ? void 0 : column.backgroundcolor,
|
|
101
|
+
position: "relative",
|
|
102
|
+
display: show ? "" : "none"
|
|
103
|
+
}
|
|
104
|
+
}, isHtmlContent ? __jsx("span", {
|
|
105
|
+
dangerouslySetInnerHTML: {
|
|
106
|
+
__html: displayValue
|
|
107
|
+
}
|
|
108
|
+
}) : displayValue);
|
|
109
|
+
};
|
|
110
|
+
var SummaryCell = exports.SummaryCell = /*#__PURE__*/(0, _react.memo)(SummaryCellBase);
|
|
111
|
+
SummaryCell.displayName = "SummaryCell";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.SummaryRow = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
var _SummaryCell = require("./SummaryCell");
|
|
11
|
+
var _utils = require("../utils");
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
13
|
+
var __jsx = _react["default"].createElement;
|
|
14
|
+
/**
|
|
15
|
+
* SummaryRow Component
|
|
16
|
+
* Renders a single row in the summary row footer.
|
|
17
|
+
* Maps over columns to render SummaryCell components.
|
|
18
|
+
*/
|
|
19
|
+
var SummaryRowBase = function SummaryRowBase(_ref) {
|
|
20
|
+
var rowDef = _ref.rowDef,
|
|
21
|
+
rowDefObject = _ref.rowDefObject,
|
|
22
|
+
rowIndex = _ref.rowIndex,
|
|
23
|
+
columns = _ref.columns,
|
|
24
|
+
summaryRowColumnShow = _ref.summaryRowColumnShow;
|
|
25
|
+
return __jsx(_material.TableRow, {
|
|
26
|
+
role: "row",
|
|
27
|
+
tabIndex: 0,
|
|
28
|
+
className: "".concat(_utils.TABLE_CSS_CLASSES.tableRow, " app-datagrid-row summary-row"),
|
|
29
|
+
"data-row-id": "summary-".concat(rowIndex)
|
|
30
|
+
}, columns.map(function (column, colIndex) {
|
|
31
|
+
var _summaryRowColumnShow;
|
|
32
|
+
var columnKey = column.field || column.binding;
|
|
33
|
+
|
|
34
|
+
// Skip columns without a binding/field
|
|
35
|
+
if (!columnKey) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Check if column should be shown based on stored show property or column's show property
|
|
40
|
+
// Priority: summaryRowColumnShow > column.show > true (default)
|
|
41
|
+
var columnShow = (summaryRowColumnShow === null || summaryRowColumnShow === void 0 || (_summaryRowColumnShow = summaryRowColumnShow[rowIndex]) === null || _summaryRowColumnShow === void 0 ? void 0 : _summaryRowColumnShow[columnKey]) !== undefined ? summaryRowColumnShow[rowIndex][columnKey] : column.show !== undefined ? column.show : true;
|
|
42
|
+
return __jsx(_SummaryCell.SummaryCell, {
|
|
43
|
+
key: "summary-cell-".concat(rowIndex, "-").concat(columnKey),
|
|
44
|
+
columnKey: columnKey,
|
|
45
|
+
column: column,
|
|
46
|
+
rowDef: rowDef,
|
|
47
|
+
rowDefObject: rowDefObject,
|
|
48
|
+
colIndex: colIndex,
|
|
49
|
+
show: columnShow
|
|
50
|
+
});
|
|
51
|
+
}));
|
|
52
|
+
};
|
|
53
|
+
var SummaryRow = exports.SummaryRow = /*#__PURE__*/(0, _react.memo)(SummaryRowBase);
|
|
54
|
+
SummaryRow.displayName = "SummaryRow";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.SummaryRowFooter = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
var _SummaryRow = require("./SummaryRow");
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
12
|
+
var __jsx = _react["default"].createElement;
|
|
13
|
+
/**
|
|
14
|
+
* SummaryRowFooter Component
|
|
15
|
+
* Renders the table footer section containing summary rows.
|
|
16
|
+
* Displays aggregated data like totals, averages, etc.
|
|
17
|
+
*/
|
|
18
|
+
var SummaryRowFooterBase = function SummaryRowFooterBase(_ref) {
|
|
19
|
+
var summaryRowDefs = _ref.summaryRowDefs,
|
|
20
|
+
summaryRowDefObjects = _ref.summaryRowDefObjects,
|
|
21
|
+
columns = _ref.columns,
|
|
22
|
+
tableName = _ref.tableName,
|
|
23
|
+
summaryRowColumnShow = _ref.summaryRowColumnShow;
|
|
24
|
+
// Don't render if no summary rows
|
|
25
|
+
if (!summaryRowDefs || summaryRowDefs.length === 0) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return __jsx(_material.TableFooter, {
|
|
29
|
+
className: "app-datagrid-footer",
|
|
30
|
+
style: {
|
|
31
|
+
borderTop: "3px solid #eee"
|
|
32
|
+
},
|
|
33
|
+
"data-table-name": tableName
|
|
34
|
+
}, summaryRowDefs.map(function (rowDef, rowIndex) {
|
|
35
|
+
return __jsx(_SummaryRow.SummaryRow, {
|
|
36
|
+
key: "summary-row-".concat(rowIndex),
|
|
37
|
+
rowDef: rowDef,
|
|
38
|
+
rowDefObject: summaryRowDefObjects[rowIndex] || {},
|
|
39
|
+
rowIndex: rowIndex,
|
|
40
|
+
columns: columns,
|
|
41
|
+
summaryRowColumnShow: summaryRowColumnShow
|
|
42
|
+
});
|
|
43
|
+
}));
|
|
44
|
+
};
|
|
45
|
+
var SummaryRowFooter = exports.SummaryRowFooter = /*#__PURE__*/(0, _react.memo)(SummaryRowFooterBase);
|
|
46
|
+
SummaryRowFooter.displayName = "SummaryRowFooter";
|