@wavemaker/react-runtime 11.14.3-rc.6401 → 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 +307 -266
- 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,109 +6,152 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useListWidgetMethods = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
-
var _react = require("react");
|
|
10
9
|
var _lodashEs = require("lodash-es");
|
|
11
|
-
var useListWidgetMethods = exports.useListWidgetMethods = function useListWidgetMethods(items, listState, multiselect, onSelect, widgetInstance, listener, userInitiatedSelectionRef, name) {
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// Selects an item in the list by index or model
|
|
24
|
-
var selectItem = (0, _react.useCallback)(function (val, statePersistenceTriggered) {
|
|
25
|
-
var item = getItemByIndexOrModel(val);
|
|
26
|
-
if (!item) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
var isAlreadySelected = listState.activeItems.has(item);
|
|
30
|
-
if (!isAlreadySelected) {
|
|
31
|
-
if (!statePersistenceTriggered && userInitiatedSelectionRef) {
|
|
32
|
-
userInitiatedSelectionRef.current = true;
|
|
10
|
+
var useListWidgetMethods = exports.useListWidgetMethods = function useListWidgetMethods(items, listState, multiselect, onSelect, widgetInstance, listener, userInitiatedSelectionRef, name, Widgets, size, setIsListCleared, handlePageSizeChange) {
|
|
11
|
+
// Return methods object directly without useMemo to avoid infinite re-renders
|
|
12
|
+
// Methods always have access to current values through closure
|
|
13
|
+
return {
|
|
14
|
+
// Helper function to find an item by index or model
|
|
15
|
+
getItemByIndexOrModel: function getItemByIndexOrModel(val) {
|
|
16
|
+
if (typeof val === "number") {
|
|
17
|
+
return items[val];
|
|
18
|
+
} else {
|
|
19
|
+
return items.find(function (item) {
|
|
20
|
+
return item === val;
|
|
21
|
+
});
|
|
33
22
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
23
|
+
},
|
|
24
|
+
// Selects an item in the list by index or model
|
|
25
|
+
selectItem: function selectItem(val, statePersistenceTriggered) {
|
|
26
|
+
var getItemByIndexOrModel = function getItemByIndexOrModel(val) {
|
|
27
|
+
if (typeof val === "number") {
|
|
28
|
+
return items[val];
|
|
29
|
+
} else {
|
|
30
|
+
return items.find(function (item) {
|
|
31
|
+
return item === val;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var item = getItemByIndexOrModel(val);
|
|
36
|
+
if (!item) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
var isAlreadySelected = listState.activeItems.has(item);
|
|
40
|
+
if (!isAlreadySelected) {
|
|
41
|
+
if (!statePersistenceTriggered && userInitiatedSelectionRef) {
|
|
42
|
+
userInitiatedSelectionRef.current = true;
|
|
43
|
+
}
|
|
44
|
+
if (multiselect) {
|
|
45
|
+
var newSelectedItems = [].concat((0, _toConsumableArray2["default"])(listState.selectedItems), [item]);
|
|
46
|
+
var newActiveItems = new Set(listState.activeItems);
|
|
47
|
+
newActiveItems.add(item);
|
|
48
|
+
listState.setSelectedItems(newSelectedItems);
|
|
49
|
+
listState.setActiveItems(newActiveItems);
|
|
50
|
+
if (!listState.firstSelectedItem) {
|
|
51
|
+
listState.setFirstSelectedItem(item);
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
listState.setSelectedItems([item]);
|
|
55
|
+
listState.setActiveItems(new Set([item]));
|
|
41
56
|
listState.setFirstSelectedItem(item);
|
|
42
57
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
listState.setFirstSelectedItem(item);
|
|
58
|
+
if (onSelect && widgetInstance && !statePersistenceTriggered) {
|
|
59
|
+
onSelect(widgetInstance, item);
|
|
60
|
+
}
|
|
47
61
|
}
|
|
48
|
-
|
|
49
|
-
|
|
62
|
+
},
|
|
63
|
+
// Deselects an item in the list by index or model
|
|
64
|
+
deselectItem: function deselectItem(val) {
|
|
65
|
+
var getItemByIndexOrModel = function getItemByIndexOrModel(val) {
|
|
66
|
+
if (typeof val === "number") {
|
|
67
|
+
return items[val];
|
|
68
|
+
} else {
|
|
69
|
+
return items.find(function (item) {
|
|
70
|
+
return item === val;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
var item = getItemByIndexOrModel(val);
|
|
75
|
+
if (!item) {
|
|
76
|
+
return;
|
|
50
77
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
78
|
+
var isSelected = Array.from(listState.activeItems).some(function (activeItem) {
|
|
79
|
+
return (0, _lodashEs.isEqual)(activeItem, item);
|
|
80
|
+
});
|
|
81
|
+
if (isSelected) {
|
|
82
|
+
if (userInitiatedSelectionRef) {
|
|
83
|
+
userInitiatedSelectionRef.current = true;
|
|
84
|
+
}
|
|
85
|
+
var newSelectedItems = listState.selectedItems.filter(function (selectedItem) {
|
|
86
|
+
return !(0, _lodashEs.isEqual)(selectedItem, item);
|
|
87
|
+
});
|
|
88
|
+
var newActiveItems = new Set(Array.from(listState.activeItems).filter(function (activeItem) {
|
|
89
|
+
return !(0, _lodashEs.isEqual)(activeItem, item);
|
|
90
|
+
}));
|
|
91
|
+
listState.setSelectedItems(newSelectedItems);
|
|
92
|
+
listState.setActiveItems(newActiveItems);
|
|
93
|
+
if ((0, _lodashEs.isEqual)(listState.firstSelectedItem, item)) {
|
|
94
|
+
listState.setFirstSelectedItem(newSelectedItems[0] || null);
|
|
95
|
+
}
|
|
64
96
|
}
|
|
65
|
-
|
|
66
|
-
|
|
97
|
+
},
|
|
98
|
+
// Get item by index
|
|
99
|
+
getItem: function getItem(index) {
|
|
100
|
+
var item = items[index];
|
|
101
|
+
if (item) {
|
|
102
|
+
return {
|
|
103
|
+
item: item
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
return undefined;
|
|
107
|
+
},
|
|
108
|
+
// Get index of item
|
|
109
|
+
getIndex: function getIndex(item) {
|
|
110
|
+
var index = items.findIndex(function (listItem) {
|
|
111
|
+
return (0, _lodashEs.isEqual)(listItem, item);
|
|
67
112
|
});
|
|
68
|
-
|
|
69
|
-
return
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
113
|
+
if (index !== -1) {
|
|
114
|
+
return index;
|
|
115
|
+
}
|
|
116
|
+
return -1;
|
|
117
|
+
},
|
|
118
|
+
// Clear all selections
|
|
119
|
+
clear: function clear() {
|
|
120
|
+
setIsListCleared === null || setIsListCleared === void 0 || setIsListCleared(true);
|
|
121
|
+
},
|
|
122
|
+
// Get widgets by name and optional index
|
|
123
|
+
getWidgets: function getWidgets(widgetName, index) {
|
|
124
|
+
if (!widgetName) {
|
|
125
|
+
return undefined;
|
|
75
126
|
}
|
|
76
|
-
}
|
|
77
|
-
}, [listState.activeItems, listState.selectedItems]);
|
|
78
|
-
var getItem = (0, _react.useCallback)(function (index) {
|
|
79
|
-
return items[index];
|
|
80
|
-
}, []);
|
|
81
|
-
var getIndex = (0, _react.useCallback)(function (item) {
|
|
82
|
-
return items.findIndex(function (listItem) {
|
|
83
|
-
return (0, _lodashEs.isEqual)(listItem, item);
|
|
84
|
-
});
|
|
85
|
-
}, []);
|
|
86
|
-
var clear = (0, _react.useCallback)(function () {
|
|
87
|
-
listState.setSelectedItems([]);
|
|
88
|
-
listState.setActiveItems(new Set());
|
|
89
|
-
listState.setFirstSelectedItem(null);
|
|
90
|
-
var listener_instance = name && (listener === null || listener === void 0 ? void 0 : listener.Widgets[name]);
|
|
91
|
-
if (listener_instance) {
|
|
92
|
-
listener_instance.selecteditem = undefined;
|
|
93
|
-
}
|
|
94
|
-
}, [listState.setSelectedItems, listState.setActiveItems, listState.setFirstSelectedItem]);
|
|
95
|
-
var getWidgets = (0, _react.useCallback)(function (widgetName, index) {
|
|
96
|
-
if (widgetInstance && widgetInstance[widgetName]) {
|
|
97
|
-
return widgetInstance[widgetName];
|
|
98
|
-
}
|
|
99
|
-
return listener === null || listener === void 0 ? void 0 : listener.Widgets[widgetName];
|
|
100
|
-
}, []);
|
|
101
127
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
128
|
+
// Helper to find widget with optional random suffix (e.g., _dfj, _fdj)
|
|
129
|
+
var findWidget = function findWidget(prefix) {
|
|
130
|
+
// Look for key with random suffix pattern: prefix_xxx
|
|
131
|
+
for (var key in Widgets) {
|
|
132
|
+
if (key.startsWith(prefix + "_") || key === prefix) {
|
|
133
|
+
return Widgets[key];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return null;
|
|
137
|
+
};
|
|
138
|
+
if (index !== undefined) {
|
|
139
|
+
return findWidget("".concat(name, "_").concat(index, "_").concat(widgetName));
|
|
140
|
+
}
|
|
141
|
+
var items = [];
|
|
142
|
+
for (var i = 0; i < (size || 0); i++) {
|
|
143
|
+
var item = findWidget("".concat(name, "_").concat(i, "_").concat(widgetName));
|
|
144
|
+
if (item) {
|
|
145
|
+
items.push(item);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return items;
|
|
149
|
+
},
|
|
150
|
+
// Select page size - changes the pagination page size
|
|
151
|
+
selectPageSize: function selectPageSize(newPageSize) {
|
|
152
|
+
if (handlePageSizeChange && typeof newPageSize === "number" && newPageSize > 0) {
|
|
153
|
+
handlePageSizeChange(newPageSize);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
};
|
|
114
157
|
};
|
|
@@ -31,6 +31,7 @@ var WmLiveFilter = function WmLiveFilter(prop) {
|
|
|
31
31
|
var _props$listener;
|
|
32
32
|
var props = _objectSpread(_objectSpread({}, _props.DEFAULT_PROPS), prop);
|
|
33
33
|
var isInitilised = (0, _react.useRef)(false);
|
|
34
|
+
var isInvoked = (0, _react.useRef)(false);
|
|
34
35
|
var isDataSourceUpdatedRef = (0, _react.useRef)(false);
|
|
35
36
|
var dataSource = (_props$listener = props.listener) === null || _props$listener === void 0 || (_props$listener = _props$listener.Variables) === null || _props$listener === void 0 ? void 0 : _props$listener[props.dataSource];
|
|
36
37
|
function updateResults(dataSet) {
|
|
@@ -110,7 +111,9 @@ var WmLiveFilter = function WmLiveFilter(prop) {
|
|
|
110
111
|
/* Construct the formFields Variable to send it to the queryBuilder */
|
|
111
112
|
fieldsArray = (0, _lodashEs.isArray)(formFields) ? formFields : Object.values(formFields || {}); // Sync runtime values from submitted data into field definitions
|
|
112
113
|
fieldsArray.forEach(function (filterField) {
|
|
113
|
-
|
|
114
|
+
// Use fieldcol (or name) as the actual column identifier since field may contain "true"
|
|
115
|
+
var fieldKey = filterField.fieldcol || filterField.name || filterField.field;
|
|
116
|
+
var submitted = dataModel === null || dataModel === void 0 ? void 0 : dataModel[fieldKey];
|
|
114
117
|
if (filterField["isRange"]) {
|
|
115
118
|
if (submitted && (0, _typeof2["default"])(submitted) === "object") {
|
|
116
119
|
var _ref, _ref2, _submitted$minValue, _ref3, _ref4, _submitted$maxValue;
|
|
@@ -119,21 +122,22 @@ var WmLiveFilter = function WmLiveFilter(prop) {
|
|
|
119
122
|
}
|
|
120
123
|
} else {
|
|
121
124
|
if (submitted !== undefined) {
|
|
122
|
-
filterField.
|
|
125
|
+
filterField.value = submitted;
|
|
123
126
|
}
|
|
124
127
|
}
|
|
125
128
|
});
|
|
126
129
|
fieldsArray.forEach(function (filterField) {
|
|
127
130
|
var fieldValue;
|
|
128
131
|
var matchMode;
|
|
129
|
-
|
|
132
|
+
// Use fieldcol (or name) as the actual column identifier since field may contain "true"
|
|
133
|
+
var colName = filterField.fieldcol || filterField.name || filterField.field;
|
|
130
134
|
var minValue = filterField._minValue;
|
|
131
135
|
var maxvalue = filterField._maxValue;
|
|
132
136
|
/* if field is part of a related entity, column name will be 'entity.fieldName' */
|
|
133
137
|
if (filterField["isRelated"]) {
|
|
134
138
|
colName += "." + filterField["lookup-field"];
|
|
135
139
|
}
|
|
136
|
-
if (filterField["isRange"]) {
|
|
140
|
+
if (filterField["isRange"] && filterField["isRange"] != "false") {
|
|
137
141
|
/*Based on the min and max values, decide the matchmode condition*/
|
|
138
142
|
fieldValue = (0, _utils.getRangeFieldValue)(minValue, maxvalue);
|
|
139
143
|
matchMode = (0, _utils.getRangeMatchMode)(minValue, maxvalue);
|
|
@@ -145,36 +149,37 @@ var WmLiveFilter = function WmLiveFilter(prop) {
|
|
|
145
149
|
};
|
|
146
150
|
}
|
|
147
151
|
} else {
|
|
148
|
-
|
|
152
|
+
var filterValue = "value" in filterField ? filterField.value : filterField.datavalue;
|
|
153
|
+
switch (filterField.widget) {
|
|
149
154
|
case _types.FormWidgetType.SELECT:
|
|
150
155
|
case _types.FormWidgetType.RADIOSET:
|
|
151
|
-
if ((0, _utils.getEnableEmptyFilter)(props.enableemptyfilter) &&
|
|
156
|
+
if ((0, _utils.getEnableEmptyFilter)(props.enableemptyfilter) && filterValue === FILTER_CONSTANTS.EMPTY_KEY) {
|
|
152
157
|
matchMode = (0, _utils.getEmptyMatchMode)(props.enableemptyfilter);
|
|
153
|
-
fieldValue =
|
|
158
|
+
fieldValue = filterValue;
|
|
154
159
|
} else {
|
|
155
160
|
if (filterField.type === _types.DataType.BOOLEAN) {
|
|
156
|
-
if ((0, _util.isDefined)(
|
|
157
|
-
fieldValue = JSON.parse(
|
|
161
|
+
if ((0, _util.isDefined)(filterValue) && filterValue !== "") {
|
|
162
|
+
fieldValue = JSON.parse(filterValue);
|
|
158
163
|
}
|
|
159
164
|
} else {
|
|
160
|
-
fieldValue =
|
|
165
|
+
fieldValue = filterValue;
|
|
161
166
|
}
|
|
162
167
|
}
|
|
163
168
|
break;
|
|
164
169
|
case _types.FormWidgetType.CHECKBOXSET:
|
|
165
170
|
case _types.FormWidgetType.CHIPS:
|
|
166
|
-
if (
|
|
167
|
-
fieldValue =
|
|
171
|
+
if (filterValue && filterValue.length) {
|
|
172
|
+
fieldValue = filterValue;
|
|
168
173
|
}
|
|
169
174
|
break;
|
|
170
175
|
case _types.FormWidgetType.CHECKBOX:
|
|
171
176
|
case _types.FormWidgetType.TOGGLE:
|
|
172
|
-
if ((0, _util.isDefined)(
|
|
173
|
-
fieldValue = filterField.type === _types.DataType.BOOLEAN ? JSON.parse(
|
|
177
|
+
if ((0, _util.isDefined)(filterValue) && filterValue !== "") {
|
|
178
|
+
fieldValue = filterField.type === _types.DataType.BOOLEAN ? JSON.parse(filterValue) : filterValue;
|
|
174
179
|
}
|
|
175
180
|
break;
|
|
176
181
|
default:
|
|
177
|
-
fieldValue =
|
|
182
|
+
fieldValue = filterValue;
|
|
178
183
|
break;
|
|
179
184
|
}
|
|
180
185
|
if ((0, _util.isDefined)(fieldValue) && fieldValue !== "" && fieldValue !== null) {
|
|
@@ -267,6 +272,12 @@ var WmLiveFilter = function WmLiveFilter(prop) {
|
|
|
267
272
|
isInitilised.current = true;
|
|
268
273
|
}
|
|
269
274
|
}, [props.dataset]);
|
|
275
|
+
(0, _react.useEffect)(function () {
|
|
276
|
+
if (dataSource && dataSource.invoke && !isInvoked.current) {
|
|
277
|
+
isInvoked.current = true;
|
|
278
|
+
dataSource.invoke();
|
|
279
|
+
}
|
|
280
|
+
}, []);
|
|
270
281
|
return (
|
|
271
282
|
// @ts-ignore
|
|
272
283
|
__jsx(_form["default"], (0, _extends2["default"])({}, props, {
|
|
@@ -23,10 +23,13 @@ var WmLiveForm = function WmLiveForm(prop) {
|
|
|
23
23
|
var props = _objectSpread(_objectSpread({}, _props.DEFAULT_PROPS), prop);
|
|
24
24
|
var dynamicFieldsRef = (0, _react.useRef)([]);
|
|
25
25
|
var isDataSourceUpdatedRef = (0, _react.useRef)(false);
|
|
26
|
+
// FIX: Store formFields ref to get current field references at API response time
|
|
27
|
+
// This prevents stale closure issue where old component's updateFormWidgetDataset is called
|
|
28
|
+
var formFieldsRef = (0, _react.useRef)([]);
|
|
26
29
|
var dataSource = props.datasource;
|
|
27
|
-
function formSubmit(formData, success, error) {
|
|
30
|
+
function formSubmit(formData, success, error, operation) {
|
|
28
31
|
var primaryKeys = dataSource.execute("getPrimaryKey");
|
|
29
|
-
var operationType = (0, _utils.findOperationType)(formData, primaryKeys);
|
|
32
|
+
var operationType = operation !== null && operation !== void 0 ? operation : (0, _utils.findOperationType)(formData, primaryKeys);
|
|
30
33
|
if (dynamicFieldsRef.current.length > 0) {
|
|
31
34
|
dynamicFieldsRef.current.forEach(function (field) {
|
|
32
35
|
var item = field.formKey;
|
|
@@ -45,42 +48,59 @@ var WmLiveForm = function WmLiveForm(prop) {
|
|
|
45
48
|
return payload;
|
|
46
49
|
};
|
|
47
50
|
if (operationType === "delete") {
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
formData = _objectSpread(_objectSpread({}, formData), {}, {
|
|
52
|
+
row: formData
|
|
53
|
+
});
|
|
54
|
+
} else {
|
|
55
|
+
formData = {
|
|
56
|
+
inputFields: formData
|
|
57
|
+
};
|
|
50
58
|
}
|
|
51
|
-
props.
|
|
52
|
-
|
|
53
|
-
|
|
59
|
+
if (props.onBeforeservicecall) {
|
|
60
|
+
var event = new Event("submit");
|
|
61
|
+
props.onBeforeservicecall(event, operationType, formData, dataSource.options);
|
|
62
|
+
}
|
|
63
|
+
props.formSubmit(formData, operationType, successWithOperationType, error);
|
|
54
64
|
}
|
|
55
65
|
function getRelatedTableData(formField) {
|
|
66
|
+
// Capture formKey to look up current field at response time (not the captured formField object)
|
|
67
|
+
var formKey = formField.formKey;
|
|
56
68
|
dataSource && dataSource.execute("getRelatedTableData", {
|
|
57
|
-
relatedField:
|
|
69
|
+
relatedField: formKey,
|
|
58
70
|
pagesize: formField.limit,
|
|
59
71
|
orderBy: formField.orderby ? (0, _replace["default"])(formField.orderby, /:/g, " ") : "",
|
|
60
72
|
filterFields: {},
|
|
61
73
|
filterExpr: formField.filterexpressions ? formField.filterexpressions : {}
|
|
62
74
|
}).then(function (response) {
|
|
63
|
-
var primaryKeys = dataSource.execute("getRelatedTablePrimaryKeys",
|
|
75
|
+
var primaryKeys = dataSource.execute("getRelatedTablePrimaryKeys", formKey);
|
|
64
76
|
var displayField = primaryKeys.length < 0 ? undefined : primaryKeys[0];
|
|
65
77
|
|
|
78
|
+
// FIX: Look up the CURRENT field from formFieldsRef at response time
|
|
79
|
+
// This ensures we call the current component's updateFormWidgetDataset, not a stale one
|
|
80
|
+
var currentField = formFieldsRef.current.find(function (f) {
|
|
81
|
+
return f.formKey === formKey;
|
|
82
|
+
});
|
|
83
|
+
|
|
66
84
|
// Check if updateFormWidgetDataset is a function before calling it
|
|
67
|
-
if (typeof
|
|
68
|
-
|
|
85
|
+
if (currentField && typeof currentField.updateFormWidgetDataset === "function") {
|
|
86
|
+
currentField.updateFormWidgetDataset(response, displayField);
|
|
69
87
|
}
|
|
70
88
|
dynamicFieldsRef.current.push({
|
|
71
|
-
formKey:
|
|
89
|
+
formKey: formKey,
|
|
72
90
|
dataset: response.data,
|
|
73
91
|
displayField: displayField
|
|
74
92
|
});
|
|
75
93
|
});
|
|
76
94
|
}
|
|
77
|
-
|
|
95
|
+
var onDataSourceChange = (0, _react.useCallback)(function (formFields) {
|
|
96
|
+
// FIX: Always update formFieldsRef with latest fields so async callbacks get current references
|
|
97
|
+
formFieldsRef.current = formFields;
|
|
78
98
|
if (isDataSourceUpdatedRef.current) return;
|
|
79
|
-
if (formFields.length > 0) {
|
|
80
|
-
isDataSourceUpdatedRef.current = true;
|
|
81
|
-
}
|
|
82
99
|
formFields.forEach(function (field) {
|
|
83
|
-
|
|
100
|
+
// FIX: Ignore field.isDataSetBound since isDataSourceUpdatedRef already guards against re-processing.
|
|
101
|
+
// The field's isDataSetBound state persists across dialog close/reopen, causing the bug.
|
|
102
|
+
// isDataSourceUpdatedRef is the correct source of truth for whether this LiveForm session has processed fields.
|
|
103
|
+
if ((0, _fieldDataUtils.isDataSetWidget)(field.widget) && field["isRelated"]) {
|
|
84
104
|
getRelatedTableData(field);
|
|
85
105
|
// Check if setIsDataSetBound is a function before calling it
|
|
86
106
|
if (typeof field.setIsDataSetBound === "function") {
|
|
@@ -88,7 +108,20 @@ var WmLiveForm = function WmLiveForm(prop) {
|
|
|
88
108
|
}
|
|
89
109
|
}
|
|
90
110
|
});
|
|
91
|
-
|
|
111
|
+
if (formFields.length > 0) {
|
|
112
|
+
isDataSourceUpdatedRef.current = true;
|
|
113
|
+
}
|
|
114
|
+
}, []);
|
|
115
|
+
|
|
116
|
+
// Destroy widget when component unmounts
|
|
117
|
+
(0, _react.useEffect)(function () {
|
|
118
|
+
return function () {
|
|
119
|
+
if (props.destroy) {
|
|
120
|
+
props.destroy([props.name]);
|
|
121
|
+
}
|
|
122
|
+
isDataSourceUpdatedRef.current = false;
|
|
123
|
+
};
|
|
124
|
+
}, [props.destroy, props.name]);
|
|
92
125
|
return (
|
|
93
126
|
// @ts-ignore
|
|
94
127
|
__jsx(_form["default"], (0, _extends2["default"])({}, props, {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.DEFAULT_PROPS = void 0;
|
|
7
7
|
var DEFAULT_PROPS = exports.DEFAULT_PROPS = {
|
|
8
8
|
validationtype: "default",
|
|
9
|
-
defaultmode: "
|
|
9
|
+
defaultmode: "view",
|
|
10
10
|
formlayout: "inline",
|
|
11
11
|
insertmessage: "Record added successfully",
|
|
12
12
|
updatemessage: "Record updated successfully",
|
|
@@ -14,6 +14,20 @@ var _Pagination = _interopRequireDefault(require("@mui/material/Pagination"));
|
|
|
14
14
|
var _PaginationItem = _interopRequireDefault(require("@mui/material/PaginationItem"));
|
|
15
15
|
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); }
|
|
16
16
|
var __jsx = _react["default"].createElement;
|
|
17
|
+
// Constants for class names
|
|
18
|
+
var CUSTOM_CLASSES = ["active", "disabled", "pagination-page", "pagination-prev", "pagination-next", "pagination-first", "pagination-last", "page-item"];
|
|
19
|
+
var PAGE_ITEM_CLASS = "page-item";
|
|
20
|
+
var PAGE_LINK_CLASS = "page-link";
|
|
21
|
+
|
|
22
|
+
// Map MUI icon test IDs to pagination class names
|
|
23
|
+
var ICON_TO_CLASS_MAP = {
|
|
24
|
+
NavigateBeforeIcon: "pagination-prev",
|
|
25
|
+
KeyboardArrowLeftIcon: "pagination-prev",
|
|
26
|
+
NavigateNextIcon: "pagination-next",
|
|
27
|
+
KeyboardArrowRightIcon: "pagination-next",
|
|
28
|
+
FirstPageIcon: "pagination-first",
|
|
29
|
+
LastPageIcon: "pagination-last"
|
|
30
|
+
};
|
|
17
31
|
var BasicPagination = exports.BasicPagination = function BasicPagination(_ref) {
|
|
18
32
|
var pageCount = _ref.pageCount,
|
|
19
33
|
currentPage = _ref.currentPage,
|
|
@@ -29,30 +43,68 @@ var BasicPagination = exports.BasicPagination = function BasicPagination(_ref) {
|
|
|
29
43
|
maxsize = _ref$maxsize === void 0 ? 5 : _ref$maxsize,
|
|
30
44
|
onPageChange = _ref.onPageChange;
|
|
31
45
|
var paginationRef = (0, _react.useRef)(null);
|
|
46
|
+
var addNavigationClasses = (0, _react.useCallback)(function (li, anchor, testId, isDisabled) {
|
|
47
|
+
if (!testId || !ICON_TO_CLASS_MAP[testId]) return;
|
|
48
|
+
var paginationClass = ICON_TO_CLASS_MAP[testId];
|
|
49
|
+
li.classList.add(paginationClass, PAGE_ITEM_CLASS);
|
|
50
|
+
if (isDisabled) {
|
|
51
|
+
li.classList.add("disabled");
|
|
52
|
+
}
|
|
53
|
+
}, []);
|
|
54
|
+
var updateClasses = (0, _react.useCallback)(function () {
|
|
55
|
+
if (!paginationRef.current) return;
|
|
56
|
+
var allLis = paginationRef.current.querySelectorAll(".MuiPagination-ul > li");
|
|
57
|
+
allLis.forEach(function (li) {
|
|
58
|
+
var _li$classList;
|
|
59
|
+
// Remove all custom classes first
|
|
60
|
+
(_li$classList = li.classList).remove.apply(_li$classList, CUSTOM_CLASSES);
|
|
61
|
+
var anchor = li.querySelector("a");
|
|
62
|
+
if (!anchor) return;
|
|
63
|
+
var isNavigationButton = anchor.classList.contains("MuiPaginationItem-previousNext");
|
|
64
|
+
var isPageButton = anchor.classList.contains("MuiPaginationItem-page");
|
|
65
|
+
var isDisabled = anchor.classList.contains("Mui-disabled");
|
|
66
|
+
var isSelected = anchor.classList.contains("Mui-selected");
|
|
67
|
+
if (isNavigationButton) {
|
|
68
|
+
var _svg$getAttribute;
|
|
69
|
+
var svg = anchor.querySelector("svg");
|
|
70
|
+
var testId = (_svg$getAttribute = svg === null || svg === void 0 ? void 0 : svg.getAttribute("data-testid")) !== null && _svg$getAttribute !== void 0 ? _svg$getAttribute : null;
|
|
71
|
+
addNavigationClasses(li, anchor, testId, isDisabled);
|
|
72
|
+
} else if (isPageButton) {
|
|
73
|
+
li.classList.add("pagination-page", PAGE_ITEM_CLASS);
|
|
74
|
+
if (isSelected) {
|
|
75
|
+
li.classList.add("active");
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Add page-link class to anchor if not already present
|
|
80
|
+
if (!anchor.classList.contains(PAGE_LINK_CLASS)) {
|
|
81
|
+
anchor.classList.add(PAGE_LINK_CLASS);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}, [addNavigationClasses]);
|
|
32
85
|
(0, _react.useEffect)(function () {
|
|
33
|
-
//
|
|
86
|
+
// Update classes immediately for instant visual feedback
|
|
87
|
+
updateClasses();
|
|
88
|
+
|
|
89
|
+
// Also schedule an update after a frame to catch any delayed MUI updates
|
|
34
90
|
var rafId = requestAnimationFrame(function () {
|
|
35
|
-
|
|
36
|
-
var allLis = paginationRef.current.querySelectorAll(".MuiPagination-ul > li");
|
|
37
|
-
allLis.forEach(function (li) {
|
|
38
|
-
li.classList.remove("active");
|
|
39
|
-
var anchor = li.querySelector("a");
|
|
40
|
-
if (anchor !== null && anchor !== void 0 && anchor.classList.contains("Mui-selected")) {
|
|
41
|
-
li.classList.add("active");
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
91
|
+
updateClasses();
|
|
45
92
|
});
|
|
46
93
|
return function () {
|
|
47
|
-
|
|
94
|
+
cancelAnimationFrame(rafId);
|
|
48
95
|
};
|
|
49
|
-
}, [currentPage]);
|
|
96
|
+
}, [currentPage, pageCount, updateClasses]);
|
|
50
97
|
return __jsx(_Box["default"], {
|
|
51
98
|
ref: paginationRef,
|
|
52
|
-
component: "
|
|
53
|
-
className: (0, _clsx["default"])("pagination", "basic", navigationClass),
|
|
99
|
+
component: "nav",
|
|
54
100
|
role: "navigation",
|
|
55
|
-
"aria-label": "Showing Page ".concat(currentPage, " of ").concat(pageCount, " pages")
|
|
101
|
+
"aria-label": "Showing Page ".concat(currentPage, " of ").concat(pageCount, " pages"),
|
|
102
|
+
sx: {
|
|
103
|
+
// Hide MUI SVG icons for navigation buttons since CSS ::before will provide the icons
|
|
104
|
+
"& .MuiPaginationItem-previousNext .MuiPaginationItem-icon": {
|
|
105
|
+
display: "none"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
56
108
|
}, __jsx(_Pagination["default"], {
|
|
57
109
|
count: pageCount,
|
|
58
110
|
page: currentPage,
|
|
@@ -63,6 +115,9 @@ var BasicPagination = exports.BasicPagination = function BasicPagination(_ref) {
|
|
|
63
115
|
hideNextButton: !directionlinks,
|
|
64
116
|
size: navigationsize === "small" ? "small" : "medium",
|
|
65
117
|
siblingCount: Math.floor(maxsize / 2),
|
|
118
|
+
classes: {
|
|
119
|
+
ul: (0, _clsx["default"])("pagination", "basic", navigationClass)
|
|
120
|
+
},
|
|
66
121
|
renderItem: function renderItem(item) {
|
|
67
122
|
return __jsx(_PaginationItem["default"], (0, _extends2["default"])({}, item, {
|
|
68
123
|
sx: {
|
|
@@ -15,7 +15,7 @@ var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
|
|
|
15
15
|
var _constants = require("../../list/utils/constants");
|
|
16
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
17
|
var __jsx = _react["default"].createElement;
|
|
18
|
-
var
|
|
18
|
+
var PageSizeSelectorComponent = function PageSizeSelectorComponent(_ref) {
|
|
19
19
|
var _ref$pagesizeoptions = _ref.pagesizeoptions,
|
|
20
20
|
pagesizeoptions = _ref$pagesizeoptions === void 0 ? "5,10,20,50,100" : _ref$pagesizeoptions,
|
|
21
21
|
_ref$maxResults = _ref.maxResults,
|
|
@@ -169,7 +169,12 @@ var PageSizeSelector = exports.PageSizeSelector = function PageSizeSelector(_ref
|
|
|
169
169
|
sx: {
|
|
170
170
|
mx: 0.5
|
|
171
171
|
}
|
|
172
|
-
}, "\xA0of\xA0"), __jsx(_Box["default"], {
|
|
172
|
+
}, "\xA0\xA0of\xA0\xA0"), __jsx(_Box["default"], {
|
|
173
173
|
component: "span"
|
|
174
174
|
}, rowSummary.totalRecords))));
|
|
175
|
-
};
|
|
175
|
+
};
|
|
176
|
+
PageSizeSelectorComponent.displayName = "PageSizeSelector";
|
|
177
|
+
var PageSizeSelector = exports.PageSizeSelector = /*#__PURE__*/(0, _react.memo)(PageSizeSelectorComponent, function (prevProps, nextProps) {
|
|
178
|
+
// Custom comparison to prevent unnecessary re-renders
|
|
179
|
+
return prevProps.pagesizeoptions === nextProps.pagesizeoptions && prevProps.maxResults === nextProps.maxResults && prevProps.currentPage === nextProps.currentPage && prevProps.dataSize === nextProps.dataSize && prevProps.paginationMeta === nextProps.paginationMeta && prevProps.onPageSizeChange === nextProps.onPageSizeChange;
|
|
180
|
+
});
|
|
@@ -22,11 +22,7 @@ var StyledPaginationList = (0, _styles.styled)("ul")(function () {
|
|
|
22
22
|
});
|
|
23
23
|
var StyledPaginationItem = (0, _styles.styled)("li")(function () {
|
|
24
24
|
return {
|
|
25
|
-
margin: "0 2px"
|
|
26
|
-
"&.disabled": {
|
|
27
|
-
opacity: 0.38,
|
|
28
|
-
pointerEvents: "none"
|
|
29
|
-
}
|
|
25
|
+
margin: "0 2px"
|
|
30
26
|
};
|
|
31
27
|
});
|
|
32
28
|
var TotalRecords = exports.TotalRecords = function TotalRecords(_ref) {
|