@wavemaker/react-runtime 11.14.2-rc.6311 → 12.0.0-next.28533
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 +32 -10
- 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 +26 -9
- 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 +1 -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/tabs/index.js +92 -14
- package/components/container/tabs/tab-pane/index.js +15 -8
- 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 +991 -180
- 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 +54 -33
- 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 +23 -7
- 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 -51
- 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 +147 -70
- 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 +99 -26
- 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 +84 -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 +5 -0
- 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 +824 -724
- 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
|
@@ -9,129 +9,160 @@ exports["default"] = exports.WmTableComponent = void 0;
|
|
|
9
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
12
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
14
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
15
|
var _react = _interopRequireWildcard(require("react"));
|
|
16
16
|
var _reactTable = require("@tanstack/react-table");
|
|
17
17
|
var _material = require("@mui/material");
|
|
18
18
|
var _lodashEs = require("lodash-es");
|
|
19
|
-
var _withBaseWrapper = _interopRequireDefault(require("
|
|
20
|
-
var _pagination = _interopRequireDefault(require("
|
|
19
|
+
var _withBaseWrapper = _interopRequireDefault(require("@wavemaker/react-runtime/higherOrder/withBaseWrapper"));
|
|
20
|
+
var _pagination = _interopRequireDefault(require("@wavemaker/react-runtime/components/data/pagination"));
|
|
21
21
|
var _hooks = require("./hooks");
|
|
22
22
|
var _utils = require("./utils");
|
|
23
|
+
var _groupHeaderUtils = require("./utils/groupHeaderUtils");
|
|
23
24
|
var _components = require("./components");
|
|
24
25
|
var _buildSelectionColumns = require("./utils/buildSelectionColumns");
|
|
25
|
-
var _LoadingComponent = _interopRequireDefault(require("
|
|
26
|
+
var _LoadingComponent = _interopRequireDefault(require("@wavemaker/react-runtime/components/data/pagination/components/LoadingComponent"));
|
|
26
27
|
var _columnProxy = require("./utils/columnProxy");
|
|
27
|
-
var _useDataSourceSubscription = require("
|
|
28
|
+
var _useDataSourceSubscription = require("@wavemaker/react-runtime/hooks/useDataSourceSubscription");
|
|
28
29
|
var _crudHandlers = require("./utils/crud-handlers");
|
|
29
|
-
var _types = require("
|
|
30
|
-
var
|
|
30
|
+
var _types = require("@wavemaker/react-runtime/components/data/types");
|
|
31
|
+
var _useEditedRows = require("./hooks/use-edited-rows");
|
|
32
|
+
var _excluded = ["name", "dataset", "navigation", "children", "listener", "pagesize", "navigationalign", "showrecordcount", "maxsize", "boundarylinks", "allowpagesizechange", "pagesizeoptions", "formposition", "editmode", "spacing", "title", "subheading", "iconclass", "exportOptions", "shownavigation", "onDemandLoad", "showrowindex", "showheader", "enablesort", "enablecolumnselection", "onColumnselect", "onColumndeselect", "radioselect", "radioselecttitle", "radioselectarialabel", "multiselect", "multiselecttitle", "multiselectarialabel", "gridfirstrowselect", "isrowselectable", "rowClass", "deleteoktext", "deletecanceltext", "confirmdelete", "errormessage", "nodatamessage", "loadingdatamsg", "insertmessage", "updatemessage", "deletemessage", "ondemandmessage", "viewlessmessage", "showviewlessbutton", "onRowDelete", "onRowUpdate", "datasource", "binddataset", "onSuccess", "onError", "onRowinsert", "onRowupdate", "onRowdelete", "onRowclick", "onSort", "onBeforerowdelete", "onBeforefilter", "onHeaderclick", "onRowselect", "onRowdeselect", "onSetrecord", "statehandler", "formName", "parentForm", "filtermode", "filteronkeypress", "searchlabel", "onBeforedatarender", "onDatarender", "className", "exportformat", "exportdatasize", "onBeforeexport", "onAfterexport"];
|
|
31
33
|
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); }
|
|
32
34
|
var __jsx = _react["default"].createElement;
|
|
33
35
|
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; }
|
|
34
36
|
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; }
|
|
35
|
-
var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(function (
|
|
36
|
-
var _datasource$paginatio2, _datasource$paginatio4;
|
|
37
|
-
var name =
|
|
38
|
-
|
|
39
|
-
dataset =
|
|
40
|
-
|
|
41
|
-
navigation =
|
|
42
|
-
children =
|
|
43
|
-
listener =
|
|
44
|
-
|
|
45
|
-
pagesize =
|
|
46
|
-
|
|
47
|
-
navigationalign =
|
|
48
|
-
|
|
49
|
-
showrecordcount =
|
|
50
|
-
|
|
51
|
-
maxsize =
|
|
52
|
-
|
|
53
|
-
boundarylinks =
|
|
54
|
-
|
|
55
|
-
allowpagesizechange =
|
|
56
|
-
|
|
57
|
-
pagesizeoptions =
|
|
58
|
-
|
|
59
|
-
formposition =
|
|
60
|
-
|
|
61
|
-
editmode =
|
|
62
|
-
|
|
63
|
-
spacing =
|
|
64
|
-
title =
|
|
65
|
-
subheading =
|
|
66
|
-
iconclass =
|
|
67
|
-
|
|
68
|
-
exportOptions =
|
|
69
|
-
|
|
70
|
-
shownavigation =
|
|
71
|
-
|
|
72
|
-
onDemandLoad =
|
|
73
|
-
|
|
74
|
-
showrowindex =
|
|
75
|
-
|
|
76
|
-
showheader =
|
|
77
|
-
|
|
78
|
-
enablesort =
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
37
|
+
var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
38
|
+
var _listener$Widgets, _datasource$paginatio2, _datasource$paginatio4;
|
|
39
|
+
var name = props.name,
|
|
40
|
+
_props$dataset = props.dataset,
|
|
41
|
+
dataset = _props$dataset === void 0 ? [] : _props$dataset,
|
|
42
|
+
_props$navigation = props.navigation,
|
|
43
|
+
navigation = _props$navigation === void 0 ? "Basic" : _props$navigation,
|
|
44
|
+
children = props.children,
|
|
45
|
+
listener = props.listener,
|
|
46
|
+
_props$pagesize = props.pagesize,
|
|
47
|
+
pagesize = _props$pagesize === void 0 ? 5 : _props$pagesize,
|
|
48
|
+
_props$navigationalig = props.navigationalign,
|
|
49
|
+
navigationalign = _props$navigationalig === void 0 ? "left" : _props$navigationalig,
|
|
50
|
+
_props$showrecordcoun = props.showrecordcount,
|
|
51
|
+
showrecordcount = _props$showrecordcoun === void 0 ? false : _props$showrecordcoun,
|
|
52
|
+
_props$maxsize = props.maxsize,
|
|
53
|
+
maxsize = _props$maxsize === void 0 ? 5 : _props$maxsize,
|
|
54
|
+
_props$boundarylinks = props.boundarylinks,
|
|
55
|
+
boundarylinks = _props$boundarylinks === void 0 ? false : _props$boundarylinks,
|
|
56
|
+
_props$allowpagesizec = props.allowpagesizechange,
|
|
57
|
+
allowpagesizechange = _props$allowpagesizec === void 0 ? false : _props$allowpagesizec,
|
|
58
|
+
_props$pagesizeoption = props.pagesizeoptions,
|
|
59
|
+
pagesizeoptions = _props$pagesizeoption === void 0 ? "5,10,20,50,100" : _props$pagesizeoption,
|
|
60
|
+
_props$formposition = props.formposition,
|
|
61
|
+
formposition = _props$formposition === void 0 ? "bottom" : _props$formposition,
|
|
62
|
+
_props$editmode = props.editmode,
|
|
63
|
+
editmode = _props$editmode === void 0 ? "none" : _props$editmode,
|
|
64
|
+
_props$spacing = props.spacing,
|
|
65
|
+
spacing = _props$spacing === void 0 ? "normal" : _props$spacing,
|
|
66
|
+
title = props.title,
|
|
67
|
+
subheading = props.subheading,
|
|
68
|
+
iconclass = props.iconclass,
|
|
69
|
+
_props$exportOptions = props.exportOptions,
|
|
70
|
+
exportOptions = _props$exportOptions === void 0 ? [] : _props$exportOptions,
|
|
71
|
+
_props$shownavigation = props.shownavigation,
|
|
72
|
+
shownavigation = _props$shownavigation === void 0 ? true : _props$shownavigation,
|
|
73
|
+
_props$onDemandLoad = props.onDemandLoad,
|
|
74
|
+
onDemandLoad = _props$onDemandLoad === void 0 ? false : _props$onDemandLoad,
|
|
75
|
+
_props$showrowindex = props.showrowindex,
|
|
76
|
+
showrowindex = _props$showrowindex === void 0 ? false : _props$showrowindex,
|
|
77
|
+
_props$showheader = props.showheader,
|
|
78
|
+
showheader = _props$showheader === void 0 ? true : _props$showheader,
|
|
79
|
+
_props$enablesort = props.enablesort,
|
|
80
|
+
enablesort = _props$enablesort === void 0 ? true : _props$enablesort,
|
|
81
|
+
_props$enablecolumnse = props.enablecolumnselection,
|
|
82
|
+
enablecolumnselection = _props$enablecolumnse === void 0 ? false : _props$enablecolumnse,
|
|
83
|
+
onColumnselect = props.onColumnselect,
|
|
84
|
+
onColumndeselect = props.onColumndeselect,
|
|
85
|
+
_props$radioselect = props.radioselect,
|
|
86
|
+
radioselect = _props$radioselect === void 0 ? false : _props$radioselect,
|
|
87
|
+
_props$radioselecttit = props.radioselecttitle,
|
|
88
|
+
radioselecttitle = _props$radioselecttit === void 0 ? "" : _props$radioselecttit,
|
|
89
|
+
_props$radioselectari = props.radioselectarialabel,
|
|
90
|
+
radioselectarialabel = _props$radioselectari === void 0 ? _utils.TABLE_MESSAGES.radioSelectAriaLabel : _props$radioselectari,
|
|
91
|
+
_props$multiselect = props.multiselect,
|
|
92
|
+
multiselect = _props$multiselect === void 0 ? false : _props$multiselect,
|
|
93
|
+
_props$multiselecttit = props.multiselecttitle,
|
|
94
|
+
multiselecttitle = _props$multiselecttit === void 0 ? "" : _props$multiselecttit,
|
|
95
|
+
_props$multiselectari = props.multiselectarialabel,
|
|
96
|
+
multiselectarialabel = _props$multiselectari === void 0 ? _utils.TABLE_MESSAGES.multiSelectAriaLabel : _props$multiselectari,
|
|
97
|
+
_props$gridfirstrowse = props.gridfirstrowselect,
|
|
98
|
+
gridfirstrowselect = _props$gridfirstrowse === void 0 ? false : _props$gridfirstrowse,
|
|
99
|
+
_props$isrowselectabl = props.isrowselectable,
|
|
100
|
+
isrowselectable = _props$isrowselectabl === void 0 ? false : _props$isrowselectabl,
|
|
101
|
+
_props$rowClass = props.rowClass,
|
|
102
|
+
rowClass = _props$rowClass === void 0 ? "" : _props$rowClass,
|
|
103
|
+
_props$deleteoktext = props.deleteoktext,
|
|
104
|
+
deleteoktext = _props$deleteoktext === void 0 ? _utils.TABLE_MESSAGES.deleteOkText : _props$deleteoktext,
|
|
105
|
+
_props$deletecancelte = props.deletecanceltext,
|
|
106
|
+
deletecanceltext = _props$deletecancelte === void 0 ? _utils.TABLE_MESSAGES.deleteCancelText : _props$deletecancelte,
|
|
107
|
+
_props$confirmdelete = props.confirmdelete,
|
|
108
|
+
confirmdelete = _props$confirmdelete === void 0 ? _utils.TABLE_MESSAGES.deleteConfirmMessage : _props$confirmdelete,
|
|
109
|
+
_props$errormessage = props.errormessage,
|
|
110
|
+
errormessage = _props$errormessage === void 0 ? _utils.TABLE_MESSAGES.operationError : _props$errormessage,
|
|
111
|
+
_props$nodatamessage = props.nodatamessage,
|
|
112
|
+
nodatamessage = _props$nodatamessage === void 0 ? _utils.TABLE_MESSAGES.noDataMessage : _props$nodatamessage,
|
|
113
|
+
_props$loadingdatamsg = props.loadingdatamsg,
|
|
114
|
+
loadingdatamsg = _props$loadingdatamsg === void 0 ? _utils.TABLE_MESSAGES.loadingMessage : _props$loadingdatamsg,
|
|
115
|
+
_props$insertmessage = props.insertmessage,
|
|
116
|
+
insertmessage = _props$insertmessage === void 0 ? _utils.TABLE_MESSAGES.insertSuccess : _props$insertmessage,
|
|
117
|
+
_props$updatemessage = props.updatemessage,
|
|
118
|
+
updatemessage = _props$updatemessage === void 0 ? _utils.TABLE_MESSAGES.updateSuccess : _props$updatemessage,
|
|
119
|
+
_props$deletemessage = props.deletemessage,
|
|
120
|
+
deletemessage = _props$deletemessage === void 0 ? _utils.TABLE_MESSAGES.deleteSuccess : _props$deletemessage,
|
|
121
|
+
_props$ondemandmessag = props.ondemandmessage,
|
|
122
|
+
ondemandmessage = _props$ondemandmessag === void 0 ? "Load More" : _props$ondemandmessag,
|
|
123
|
+
_props$viewlessmessag = props.viewlessmessage,
|
|
124
|
+
viewlessmessage = _props$viewlessmessag === void 0 ? "View Less" : _props$viewlessmessag,
|
|
125
|
+
_props$showviewlessbu = props.showviewlessbutton,
|
|
126
|
+
showviewlessbutton = _props$showviewlessbu === void 0 ? false : _props$showviewlessbu,
|
|
127
|
+
onRowDelete = props.onRowDelete,
|
|
128
|
+
onRowUpdate = props.onRowUpdate,
|
|
129
|
+
datasource = props.datasource,
|
|
130
|
+
binddataset = props.binddataset,
|
|
131
|
+
onSuccess = props.onSuccess,
|
|
132
|
+
onError = props.onError,
|
|
133
|
+
onRowinsert = props.onRowinsert,
|
|
134
|
+
onRowupdate = props.onRowupdate,
|
|
135
|
+
onRowdelete = props.onRowdelete,
|
|
136
|
+
onRowclick = props.onRowclick,
|
|
137
|
+
onSort = props.onSort,
|
|
138
|
+
onBeforerowdelete = props.onBeforerowdelete,
|
|
139
|
+
onBeforefilter = props.onBeforefilter,
|
|
140
|
+
onHeaderclick = props.onHeaderclick,
|
|
141
|
+
onRowselect = props.onRowselect,
|
|
142
|
+
onRowdeselect = props.onRowdeselect,
|
|
143
|
+
onSetrecord = props.onSetrecord,
|
|
144
|
+
statehandler = props.statehandler,
|
|
145
|
+
formName = props.formName,
|
|
146
|
+
parentForm = props.parentForm,
|
|
147
|
+
filtermode = props.filtermode,
|
|
148
|
+
_props$filteronkeypre = props.filteronkeypress,
|
|
149
|
+
filteronkeypress = _props$filteronkeypre === void 0 ? false : _props$filteronkeypre,
|
|
150
|
+
_props$searchlabel = props.searchlabel,
|
|
151
|
+
searchlabel = _props$searchlabel === void 0 ? "Search" : _props$searchlabel,
|
|
152
|
+
onBeforedatarender = props.onBeforedatarender,
|
|
153
|
+
onDatarender = props.onDatarender,
|
|
154
|
+
className = props.className,
|
|
155
|
+
exportformat = props.exportformat,
|
|
156
|
+
exportdatasize = props.exportdatasize,
|
|
157
|
+
onBeforeexport = props.onBeforeexport,
|
|
158
|
+
onAfterexport = props.onAfterexport,
|
|
159
|
+
rest = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
132
160
|
var _useState = (0, _react.useState)((datasource === null || datasource === void 0 ? void 0 : datasource.loading) || false),
|
|
133
161
|
loading = _useState[0],
|
|
134
162
|
setLoading = _useState[1];
|
|
163
|
+
var prevDatasetRef = (0, _react.useRef)(dataset);
|
|
164
|
+
var prevSelectedRow = (0, _react.useRef)(null);
|
|
165
|
+
var tableApisRegistered = (0, _react.useRef)(false);
|
|
135
166
|
(0, _react.useEffect)(function () {
|
|
136
167
|
// Sync local loading state with datasource loading
|
|
137
168
|
if ((datasource === null || datasource === void 0 ? void 0 : datasource.loading) !== undefined) {
|
|
@@ -139,15 +170,15 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
139
170
|
}
|
|
140
171
|
}, [datasource === null || datasource === void 0 ? void 0 : datasource.loading]);
|
|
141
172
|
|
|
142
|
-
// State for accumulated data in Scroll navigation
|
|
173
|
+
// State for accumulated data in Scroll and On-Demand navigation modes
|
|
143
174
|
var _useState2 = (0, _react.useState)([]),
|
|
144
|
-
|
|
145
|
-
|
|
175
|
+
accumulatedData = _useState2[0],
|
|
176
|
+
setAccumulatedData = _useState2[1];
|
|
146
177
|
|
|
147
|
-
// Callback to receive accumulated data from pagination
|
|
148
|
-
var
|
|
178
|
+
// Callback to receive accumulated data from pagination (for Scroll and On-Demand)
|
|
179
|
+
var handleAccumulatedDataUpdate = (0, _react.useCallback)(function (data) {
|
|
149
180
|
// Only update if data has actually changed to prevent unnecessary re-renders
|
|
150
|
-
|
|
181
|
+
setAccumulatedData(function (prevData) {
|
|
151
182
|
// If lengths are different, it's definitely new data
|
|
152
183
|
if (prevData.length !== data.length) {
|
|
153
184
|
return data;
|
|
@@ -157,10 +188,10 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
157
188
|
});
|
|
158
189
|
}, []);
|
|
159
190
|
|
|
160
|
-
// Reset accumulated data when navigation changes
|
|
191
|
+
// Reset accumulated data when navigation changes
|
|
161
192
|
(0, _react.useEffect)(function () {
|
|
162
|
-
if (navigation !== "Scroll") {
|
|
163
|
-
|
|
193
|
+
if (navigation !== "Scroll" && navigation !== "On-Demand") {
|
|
194
|
+
setAccumulatedData([]);
|
|
164
195
|
}
|
|
165
196
|
}, [navigation]);
|
|
166
197
|
|
|
@@ -173,9 +204,12 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
173
204
|
|
|
174
205
|
// Determine if we're using server-side pagination
|
|
175
206
|
// Check if datasource is API-aware (server-side) rather than checking runtime pagination data
|
|
176
|
-
var isServerSidePagination = (0, _react.
|
|
207
|
+
var isServerSidePagination = (0, _react.useCallback)(function () {
|
|
208
|
+
if (navigation === "None") {
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
177
211
|
return !!(datasource && datasource.execute && datasource.execute(_types.DataSource.Operation.IS_PAGEABLE));
|
|
178
|
-
}, [datasource]);
|
|
212
|
+
}, [datasource, navigation]);
|
|
179
213
|
|
|
180
214
|
// Disable state management for Scroll navigation
|
|
181
215
|
var effectiveStateHandler = navigation === "Scroll" ? "none" : statehandler;
|
|
@@ -208,7 +242,9 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
208
242
|
onSuccess: onSuccess,
|
|
209
243
|
onError: onError,
|
|
210
244
|
onRowdelete: onRowdelete,
|
|
211
|
-
isServerSidePagination: isServerSidePagination
|
|
245
|
+
isServerSidePagination: isServerSidePagination(),
|
|
246
|
+
listener: listener,
|
|
247
|
+
widgetName: name
|
|
212
248
|
}),
|
|
213
249
|
internalDataset = _useTableData.internalDataset,
|
|
214
250
|
setInternalDataset = _useTableData.setInternalDataset,
|
|
@@ -240,7 +276,7 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
240
276
|
var persisted = (0, _utils.getTableState)(name, effectiveStateHandler);
|
|
241
277
|
|
|
242
278
|
// Determine the actual page size (original datasource page size)
|
|
243
|
-
var actualPageSize;
|
|
279
|
+
var actualPageSize = 0;
|
|
244
280
|
if ((persisted === null || persisted === void 0 ? void 0 : persisted.actualpagesize) !== undefined) {
|
|
245
281
|
// If we have a persisted actualPageSize, use it (it should never change)
|
|
246
282
|
actualPageSize = persisted.actualpagesize;
|
|
@@ -263,7 +299,7 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
263
299
|
var persistedPageSize = persisted.pagesize || pagesize;
|
|
264
300
|
|
|
265
301
|
// Set datasource maxResults if we have a persisted pageSize and datasource
|
|
266
|
-
if (persisted.pagesize && isServerSidePagination && datasource && datasource.maxResults !== undefined) {
|
|
302
|
+
if (persisted.pagesize && isServerSidePagination() && datasource && datasource.maxResults !== undefined) {
|
|
267
303
|
datasource.maxResults = persistedPageSize;
|
|
268
304
|
}
|
|
269
305
|
return {
|
|
@@ -276,12 +312,12 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
276
312
|
}
|
|
277
313
|
return {
|
|
278
314
|
initialPage: 1,
|
|
279
|
-
initialPageSize:
|
|
280
|
-
initialActualPageSize:
|
|
315
|
+
initialPageSize: actualPageSize,
|
|
316
|
+
initialActualPageSize: pagesize,
|
|
281
317
|
initialSearchState: undefined,
|
|
282
318
|
initialSortState: undefined
|
|
283
319
|
};
|
|
284
|
-
}, [name, effectiveStateHandler, pagesize, isServerSidePagination, datasource, navigation]),
|
|
320
|
+
}, [name, effectiveStateHandler, pagesize, isServerSidePagination(), datasource, navigation]),
|
|
285
321
|
initialPage = _useMemo.initialPage,
|
|
286
322
|
initialPageSize = _useMemo.initialPageSize,
|
|
287
323
|
initialActualPageSize = _useMemo.initialActualPageSize,
|
|
@@ -294,10 +330,27 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
294
330
|
// Track previous page index to detect actual page changes
|
|
295
331
|
var prevPageIndexRef = (0, _react.useRef)(-1);
|
|
296
332
|
|
|
333
|
+
// Use pagination state hook - manages controlled pagination state
|
|
334
|
+
var _usePaginationState = (0, _hooks.usePaginationState)({
|
|
335
|
+
initialPage: initialPage,
|
|
336
|
+
initialPageSize: initialPageSize,
|
|
337
|
+
editmode: editmode,
|
|
338
|
+
internalDataset: internalDataset,
|
|
339
|
+
datasource: datasource,
|
|
340
|
+
isServerSidePagination: isServerSidePagination()
|
|
341
|
+
}),
|
|
342
|
+
paginationState = _usePaginationState.paginationState,
|
|
343
|
+
setPaginationState = _usePaginationState.setPaginationState,
|
|
344
|
+
handlePaginationChange = _usePaginationState.handlePaginationChange,
|
|
345
|
+
handlePageSizeChangeBase = _usePaginationState.handlePageSizeChange;
|
|
346
|
+
|
|
347
|
+
// Multiselect is only valid when editmode is "quickedit" or "inline"
|
|
348
|
+
var effectiveMultiselect = multiselect;
|
|
349
|
+
|
|
297
350
|
// Use row selection hook
|
|
298
351
|
var _useRowSelection = (0, _hooks.useRowSelection)({
|
|
299
352
|
radioselect: radioselect,
|
|
300
|
-
multiselect:
|
|
353
|
+
multiselect: effectiveMultiselect,
|
|
301
354
|
gridfirstrowselect: gridfirstrowselect,
|
|
302
355
|
internalDataset: internalDataset,
|
|
303
356
|
cellState: cellState,
|
|
@@ -312,9 +365,12 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
312
365
|
currentPage: 1,
|
|
313
366
|
currentPageSize: pagesize
|
|
314
367
|
};
|
|
315
|
-
}
|
|
368
|
+
},
|
|
369
|
+
onRowselect: onRowselect,
|
|
370
|
+
onRowdeselect: onRowdeselect,
|
|
371
|
+
listener: listener,
|
|
372
|
+
navigation: navigation
|
|
316
373
|
}),
|
|
317
|
-
selectedRowId = _useRowSelection.selectedRowId,
|
|
318
374
|
selectedRowIds = _useRowSelection.selectedRowIds,
|
|
319
375
|
useMultiSelect = _useRowSelection.useMultiSelect,
|
|
320
376
|
useRadioSelect = _useRowSelection.useRadioSelect,
|
|
@@ -328,13 +384,21 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
328
384
|
var _useTableState = (0, _hooks.useTableState)({
|
|
329
385
|
editMode: editmode,
|
|
330
386
|
radioselect: radioselect,
|
|
331
|
-
multiselect:
|
|
387
|
+
multiselect: effectiveMultiselect
|
|
332
388
|
}),
|
|
333
389
|
activeRowIds = _useTableState.activeRowIds,
|
|
334
390
|
setActiveRow = _useTableState.setActiveRow,
|
|
335
391
|
handleRowActiveClick = _useTableState.handleRowActiveClick,
|
|
336
392
|
isRowActive = _useTableState.isRowActive;
|
|
337
393
|
|
|
394
|
+
// Sync activeRowIds with selectedRowIds when selection modes are active
|
|
395
|
+
// This ensures that when rows are selected/deselected, the active state follows
|
|
396
|
+
(0, _react.useEffect)(function () {
|
|
397
|
+
if (useRadioSelect || useMultiSelect) {
|
|
398
|
+
setActiveRow(selectedRowIds);
|
|
399
|
+
}
|
|
400
|
+
}, [selectedRowIds, useRadioSelect, useMultiSelect, setActiveRow]);
|
|
401
|
+
|
|
338
402
|
// Use dynamic columns hook to generate columns from data when no children are provided
|
|
339
403
|
var _useDynamicColumns = (0, _hooks.useDynamicColumns)({
|
|
340
404
|
dataset: internalDataset,
|
|
@@ -363,22 +427,34 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
363
427
|
return position === "footer" || position.includes("footer") || !action.position;
|
|
364
428
|
});
|
|
365
429
|
|
|
430
|
+
// Parse table structure with groups support
|
|
431
|
+
var structure = (0, _utils.parseTableStructureWithGroups)(children);
|
|
432
|
+
var flatColumns = (0, _utils.flattenTableStructure)(structure);
|
|
433
|
+
|
|
366
434
|
// Get static columns from children
|
|
367
|
-
var staticColumns = (0, _utils.parseTableColumns)(children);
|
|
435
|
+
var staticColumns = (0, _utils.parseTableColumns)(children, internalDataset);
|
|
368
436
|
|
|
369
|
-
//
|
|
370
|
-
|
|
371
|
-
|
|
437
|
+
// Check if we have groups in the structure
|
|
438
|
+
var hasGroups = structure.some(function (item) {
|
|
439
|
+
return "isGroup" in item && item.isGroup;
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
// Determine final columns:
|
|
443
|
+
// - If groups exist, use flatColumns (from structure) to preserve group structure
|
|
444
|
+
// - Otherwise, prefer static columns, then dynamic columns, then flat columns from structure
|
|
445
|
+
var finalColumns = hasGroups && flatColumns.length > 0 ? flatColumns : staticColumns.length > 0 ? staticColumns : isDynamicTable && dynamicColumns.length > 0 ? dynamicColumns : flatColumns;
|
|
372
446
|
return {
|
|
373
447
|
wmTableColumns: finalColumns,
|
|
448
|
+
tableStructure: structure,
|
|
374
449
|
rowActions: (0, _utils.parseTableRowActions)(children),
|
|
375
450
|
tableActions: filteredActions,
|
|
376
451
|
headerActions: headerActions,
|
|
377
452
|
footerActions: footerActions,
|
|
378
453
|
rowExpansionConfig: (0, _utils.parseTableRowExpansion)(children)
|
|
379
454
|
};
|
|
380
|
-
}, [children, editmode, dynamicColumns]),
|
|
455
|
+
}, [children, editmode, internalDataset, isDynamicTable, dynamicColumns]),
|
|
381
456
|
wmTableColumns = _useMemo2.wmTableColumns,
|
|
457
|
+
tableStructure = _useMemo2.tableStructure,
|
|
382
458
|
rowActions = _useMemo2.rowActions,
|
|
383
459
|
headerActions = _useMemo2.headerActions,
|
|
384
460
|
footerActions = _useMemo2.footerActions,
|
|
@@ -401,7 +477,7 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
401
477
|
},
|
|
402
478
|
showrowindex: showrowindex,
|
|
403
479
|
radioselect: radioselect,
|
|
404
|
-
multiselect:
|
|
480
|
+
multiselect: effectiveMultiselect,
|
|
405
481
|
rowActions: rowActions,
|
|
406
482
|
formposition: formposition,
|
|
407
483
|
insertmessage: insertmessage,
|
|
@@ -418,7 +494,8 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
418
494
|
onRowupdate: onRowupdate,
|
|
419
495
|
onRowdelete: onRowdelete,
|
|
420
496
|
tableRef: tableRef,
|
|
421
|
-
isServerSidePagination: isServerSidePagination
|
|
497
|
+
isServerSidePagination: isServerSidePagination(),
|
|
498
|
+
tableName: name
|
|
422
499
|
}),
|
|
423
500
|
editingRowId = _useTableEdit.editingRowId,
|
|
424
501
|
isRowEditing = _useTableEdit.isRowEditing,
|
|
@@ -439,10 +516,26 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
439
516
|
handleRowSelectionClick: handleRowSelectionClick,
|
|
440
517
|
handleTableEditRowClick: handleTableEditRowClick,
|
|
441
518
|
handleRowActiveClick: handleRowActiveClick,
|
|
442
|
-
onRowclick: onRowclick
|
|
519
|
+
onRowclick: onRowclick,
|
|
520
|
+
useRadioSelect: useRadioSelect,
|
|
521
|
+
useMultiSelect: useMultiSelect,
|
|
522
|
+
isrowselectable: isrowselectable,
|
|
523
|
+
listener: listener,
|
|
524
|
+
name: name
|
|
443
525
|
}),
|
|
444
526
|
handleRowClick = _useRowHandlers.handleRowClick;
|
|
445
527
|
|
|
528
|
+
// Effect to cancel editing when page changes
|
|
529
|
+
(0, _react.useEffect)(function () {
|
|
530
|
+
var currentPage = paginationState.pageIndex;
|
|
531
|
+
// Skip on initial render (when prevPageIndexRef is still -1)
|
|
532
|
+
// The ref is initialized to -1 and only updated after first data render
|
|
533
|
+
if (prevPageIndexRef.current !== -1 && currentPage !== prevPageIndexRef.current && isAddingNewRow) {
|
|
534
|
+
cancelEditing();
|
|
535
|
+
}
|
|
536
|
+
// Don't update the ref here - it's updated in the data render effect
|
|
537
|
+
}, [paginationState.pageIndex, isAddingNewRow, cancelEditing]);
|
|
538
|
+
|
|
446
539
|
// Track sorting and column sizing states
|
|
447
540
|
var _useState3 = (0, _react.useState)(function () {
|
|
448
541
|
// Convert initialSortState to TanStack Table sorting format
|
|
@@ -463,14 +556,47 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
463
556
|
isResizing = _useState5[0],
|
|
464
557
|
setIsResizing = _useState5[1];
|
|
465
558
|
|
|
559
|
+
// Column selection handlers - just call the external callbacks
|
|
560
|
+
// The class toggling is handled directly in TableHeaderComponent
|
|
561
|
+
var handleColumnSelect = (0, _react.useCallback)(function (event, columnId, colDef, columnData) {
|
|
562
|
+
if (onColumnselect) {
|
|
563
|
+
onColumnselect(event, {
|
|
564
|
+
field: columnId,
|
|
565
|
+
colDef: colDef,
|
|
566
|
+
data: columnData
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
}, [onColumnselect]);
|
|
570
|
+
var handleColumnDeselect = (0, _react.useCallback)(function (event, columnId, colDef, columnData) {
|
|
571
|
+
if (onColumndeselect) {
|
|
572
|
+
onColumndeselect(event, {
|
|
573
|
+
field: columnId,
|
|
574
|
+
colDef: colDef,
|
|
575
|
+
data: columnData
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
}, [onColumndeselect]);
|
|
579
|
+
|
|
466
580
|
// Custom sorting change handler that resets page to 1 when sorting changes
|
|
467
581
|
var handleSortingChange = (0, _react.useCallback)(function (updaterOrValue) {
|
|
582
|
+
var newSorting = typeof updaterOrValue === "function" ? updaterOrValue(sorting) : updaterOrValue;
|
|
468
583
|
setSorting(updaterOrValue);
|
|
469
584
|
// Reset to first page when sorting changes
|
|
470
|
-
|
|
471
|
-
|
|
585
|
+
setPaginationState(function (prev) {
|
|
586
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
587
|
+
pageIndex: 0
|
|
588
|
+
});
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
// Trigger onSort callback if provided
|
|
592
|
+
if (onSort && newSorting.length > 0) {
|
|
593
|
+
var sortData = {
|
|
594
|
+
field: newSorting[0].id,
|
|
595
|
+
direction: newSorting[0].desc ? "desc" : "asc"
|
|
596
|
+
};
|
|
597
|
+
onSort(null, listener === null || listener === void 0 ? void 0 : listener.Widgets[name], sortData);
|
|
472
598
|
}
|
|
473
|
-
}, []);
|
|
599
|
+
}, [sorting, name]);
|
|
474
600
|
|
|
475
601
|
// Use row expansion hook
|
|
476
602
|
var _useRowExpansion = (0, _hooks.useRowExpansion)({
|
|
@@ -480,6 +606,20 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
480
606
|
expandedRows = _useRowExpansion.expandedRows,
|
|
481
607
|
toggleRowExpansion = _useRowExpansion.toggleRowExpansion,
|
|
482
608
|
isRowExpanded = _useRowExpansion.isRowExpanded;
|
|
609
|
+
var handleToggleRowExpansion = (0, _react.useCallback)(function (rowId, rowData) {
|
|
610
|
+
if (listener !== null && listener !== void 0 && listener.onChange) {
|
|
611
|
+
var selecteditem = (0, _utils.cleanRowData)(rowData);
|
|
612
|
+
if (!(0, _lodashEs.isEqual)(prevSelectedRow.current, selecteditem)) {
|
|
613
|
+
prevSelectedRow.current = selecteditem;
|
|
614
|
+
listener.onChange(name, {
|
|
615
|
+
selecteditem: selecteditem
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
setTimeout(function () {
|
|
620
|
+
return toggleRowExpansion(rowId, rowData);
|
|
621
|
+
}, 0);
|
|
622
|
+
}, [name]);
|
|
483
623
|
|
|
484
624
|
// Use table columns hook to get column definitions
|
|
485
625
|
var _useTableColumns = (0, _hooks.useTableColumns)({
|
|
@@ -498,7 +638,13 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
498
638
|
saveEditing: saveEditing,
|
|
499
639
|
editingRowId: editingRowId,
|
|
500
640
|
cellState: cellState,
|
|
501
|
-
isResizing: isResizing
|
|
641
|
+
isResizing: isResizing,
|
|
642
|
+
handleRowClick: handleRowClick,
|
|
643
|
+
handleRadioSelection: handleRadioSelection,
|
|
644
|
+
handleMultiSelection: handleMultiSelection,
|
|
645
|
+
useRadioSelect: useRadioSelect,
|
|
646
|
+
useMultiSelect: useMultiSelect,
|
|
647
|
+
isRowSelected: isRowSelected
|
|
502
648
|
}),
|
|
503
649
|
baseColumns = _useTableColumns.columns;
|
|
504
650
|
|
|
@@ -507,8 +653,6 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
507
653
|
var selectionColumn = (0, _buildSelectionColumns.buildSelectionColumns)({
|
|
508
654
|
useRadioSelect: useRadioSelect,
|
|
509
655
|
useMultiSelect: useMultiSelect,
|
|
510
|
-
selectedRowId: selectedRowId,
|
|
511
|
-
// Keep these for interface compatibility but they're not used in column structure
|
|
512
656
|
selectedRowIds: selectedRowIds,
|
|
513
657
|
handleRadioSelection: handleRadioSelection,
|
|
514
658
|
handleMultiSelection: handleMultiSelection,
|
|
@@ -524,13 +668,14 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
524
668
|
return [selectionColumn].concat((0, _toConsumableArray2["default"])(baseColumns));
|
|
525
669
|
}
|
|
526
670
|
return baseColumns;
|
|
527
|
-
}, [baseColumns, useRadioSelect, useMultiSelect, handleRadioSelection, handleMultiSelection, handleSelectAll, radioselecttitle, radioselectarialabel, multiselecttitle, multiselectarialabel, name]);
|
|
671
|
+
}, [baseColumns, useRadioSelect, useMultiSelect, selectedRowIds, internalDataset, handleRadioSelection, handleMultiSelection, handleSelectAll, radioselecttitle, radioselectarialabel, multiselecttitle, multiselectarialabel, name]);
|
|
528
672
|
|
|
529
673
|
//column proxy changes
|
|
530
674
|
var columnsStateRef = (0, _react.useRef)(columns);
|
|
531
675
|
var _useState6 = (0, _react.useState)(0),
|
|
532
676
|
columnsVersion = _useState6[0],
|
|
533
677
|
setColumnsVersion = _useState6[1];
|
|
678
|
+
var parentFormColumns = (listener === null || listener === void 0 || (_listener$Widgets = listener.Widgets) === null || _listener$Widgets === void 0 || (_listener$Widgets = _listener$Widgets[parentForm]) === null || _listener$Widgets === void 0 ? void 0 : _listener$Widgets.dataoutput) || {};
|
|
534
679
|
var _useState7 = (0, _react.useState)({}),
|
|
535
680
|
columnOverrides = _useState7[0],
|
|
536
681
|
setColumnOverrides = _useState7[1];
|
|
@@ -539,9 +684,46 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
539
684
|
return _objectSpread(_objectSpread({}, prev), {}, (0, _defineProperty2["default"])({}, index, _objectSpread(_objectSpread({}, prev[index] || {}), {}, (0, _defineProperty2["default"])({}, key, value))));
|
|
540
685
|
});
|
|
541
686
|
}, []);
|
|
687
|
+
var _useState8 = (0, _react.useState)([]),
|
|
688
|
+
summaryRowDefs = _useState8[0],
|
|
689
|
+
setSummaryRowDefs = _useState8[1];
|
|
690
|
+
var _useState9 = (0, _react.useState)(false),
|
|
691
|
+
summaryRowEnabled = _useState9[0],
|
|
692
|
+
setSummaryRowEnabled = _useState9[1];
|
|
693
|
+
var _useState0 = (0, _react.useState)([]),
|
|
694
|
+
summaryRowDefObjects = _useState0[0],
|
|
695
|
+
setSummaryRowDefObjects = _useState0[1];
|
|
696
|
+
// Store column show property for summary rows: [rowIndex][columnKey] => show boolean
|
|
697
|
+
var _useState1 = (0, _react.useState)({}),
|
|
698
|
+
summaryRowColumnShow = _useState1[0],
|
|
699
|
+
setSummaryRowColumnShow = _useState1[1];
|
|
700
|
+
var setSummaryRowDef = (0, _react.useCallback)(function (columnKey, data, rowIndex, refresh, show) {
|
|
701
|
+
setSummaryRowDefs(function (prev) {
|
|
702
|
+
var newDefs = (0, _toConsumableArray2["default"])(prev);
|
|
703
|
+
newDefs[rowIndex] = _objectSpread(_objectSpread({}, newDefs[rowIndex]), {}, (0, _defineProperty2["default"])({}, columnKey, data));
|
|
704
|
+
return newDefs;
|
|
705
|
+
});
|
|
706
|
+
setSummaryRowDefObjects(function (prev) {
|
|
707
|
+
var newObjs = (0, _toConsumableArray2["default"])(prev);
|
|
708
|
+
newObjs[rowIndex] = _objectSpread(_objectSpread({}, newObjs[rowIndex]), {}, (0, _defineProperty2["default"])({}, columnKey, data));
|
|
709
|
+
return newObjs;
|
|
710
|
+
});
|
|
711
|
+
// Store column's show property
|
|
712
|
+
if (show !== undefined) {
|
|
713
|
+
setSummaryRowColumnShow(function (prev) {
|
|
714
|
+
var newShow = _objectSpread({}, prev);
|
|
715
|
+
if (!newShow[rowIndex]) {
|
|
716
|
+
newShow[rowIndex] = {};
|
|
717
|
+
}
|
|
718
|
+
newShow[rowIndex] = _objectSpread(_objectSpread({}, newShow[rowIndex]), {}, (0, _defineProperty2["default"])({}, columnKey, show));
|
|
719
|
+
return newShow;
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
setSummaryRowEnabled(true);
|
|
723
|
+
}, []);
|
|
542
724
|
var columnsProxy = (0, _react.useMemo)(function () {
|
|
543
|
-
return (0, _columnProxy.createColumnsProxy)(wmTableColumns, applyOverride, setColumnsVersion);
|
|
544
|
-
}, [wmTableColumns, applyOverride, setColumnsVersion]);
|
|
725
|
+
return (0, _columnProxy.createColumnsProxy)(wmTableColumns, applyOverride, setColumnsVersion, setSummaryRowDef);
|
|
726
|
+
}, [wmTableColumns, applyOverride, setColumnsVersion, setSummaryRowDef]);
|
|
545
727
|
columnsStateRef.current = columns;
|
|
546
728
|
var columnsForTable = (0, _react.useMemo)(function () {
|
|
547
729
|
var base = columnsStateRef.current || [];
|
|
@@ -566,7 +748,7 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
566
748
|
var _useTableFilter = (0, _hooks.useTableFilter)({
|
|
567
749
|
filterMode: filtermode,
|
|
568
750
|
columns: columnsForTable,
|
|
569
|
-
dataset: navigation === "Scroll" &&
|
|
751
|
+
dataset: (navigation === "Scroll" || navigation === "On-Demand") && accumulatedData.length > 0 ? accumulatedData : internalDataset,
|
|
570
752
|
initialSearchState: initialSearchState
|
|
571
753
|
}),
|
|
572
754
|
globalFilter = _useTableFilter.globalFilter,
|
|
@@ -583,16 +765,20 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
583
765
|
var setGlobalFilter = (0, _react.useCallback)(function (value) {
|
|
584
766
|
setGlobalFilterOriginal(value);
|
|
585
767
|
// Reset to first page when filter changes
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
768
|
+
setPaginationState(function (prev) {
|
|
769
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
770
|
+
pageIndex: 0
|
|
771
|
+
});
|
|
772
|
+
});
|
|
589
773
|
}, [setGlobalFilterOriginal]);
|
|
590
774
|
var setColumnFilter = (0, _react.useCallback)(function (columnId, value, matchMode) {
|
|
591
775
|
setColumnFilterOriginal(columnId, value, matchMode);
|
|
592
776
|
// Reset to first page when filter changes
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
777
|
+
setPaginationState(function (prev) {
|
|
778
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
779
|
+
pageIndex: 0
|
|
780
|
+
});
|
|
781
|
+
});
|
|
596
782
|
}, [setColumnFilterOriginal]);
|
|
597
783
|
|
|
598
784
|
// Use refs to track resizing state and debounce timer
|
|
@@ -619,43 +805,53 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
619
805
|
}, []);
|
|
620
806
|
|
|
621
807
|
// Create custom row selection state for TanStack Table
|
|
808
|
+
// Uses unified selectedRowIds array - works for both radio select (1 item) and multiselect (multiple items)
|
|
622
809
|
var rowSelection = (0, _react.useMemo)(function () {
|
|
623
810
|
var selection = {};
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
});
|
|
628
|
-
} else if (useRadioSelect && selectedRowId) {
|
|
629
|
-
selection[selectedRowId] = true;
|
|
630
|
-
}
|
|
811
|
+
selectedRowIds.forEach(function (id) {
|
|
812
|
+
selection[id] = true;
|
|
813
|
+
});
|
|
631
814
|
return selection;
|
|
632
|
-
}, [
|
|
815
|
+
}, [selectedRowIds]);
|
|
633
816
|
|
|
634
817
|
// Determine if we're using server-side sorting (same as server-side pagination)
|
|
635
|
-
var isServerSideSorting = isServerSidePagination;
|
|
818
|
+
var isServerSideSorting = isServerSidePagination();
|
|
636
819
|
|
|
637
|
-
// Use accumulated data for Scroll navigation, otherwise use normal dataset
|
|
820
|
+
// Use accumulated data for Scroll and On-Demand navigation, otherwise use normal dataset
|
|
638
821
|
var tableData = (0, _react.useMemo)(function () {
|
|
639
|
-
|
|
640
|
-
|
|
822
|
+
// For Scroll and On-Demand, use accumulated data from pagination
|
|
823
|
+
if ((navigation === "Scroll" || navigation === "On-Demand") && accumulatedData.length > 0) {
|
|
824
|
+
// For server-side pagination, don't apply client-side filtering as server already filters
|
|
825
|
+
return filtermode && !isServerSidePagination() ? filteredData : accumulatedData;
|
|
641
826
|
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
827
|
+
// For server-side pagination, use internalDataset directly (already filtered by server)
|
|
828
|
+
// Client-side filtering should only be applied for client-side pagination
|
|
829
|
+
return filtermode && !isServerSidePagination() ? filteredData : internalDataset;
|
|
830
|
+
}, [navigation, accumulatedData, filteredData, internalDataset, filtermode, isServerSidePagination]);
|
|
831
|
+
|
|
832
|
+
// Memoize pagination options to prevent unnecessary re-renders
|
|
833
|
+
var memoizedPagination = (0, _react.useMemo)(function () {
|
|
834
|
+
return {
|
|
835
|
+
pageSize: navigation === "None" ? (tableData === null || tableData === void 0 ? void 0 : tableData.length) || 0 : paginationState.pageSize,
|
|
836
|
+
pageIndex: paginationState.pageIndex
|
|
837
|
+
};
|
|
838
|
+
}, [navigation, tableData === null || tableData === void 0 ? void 0 : tableData.length, paginationState.pageSize, paginationState.pageIndex]);
|
|
646
839
|
var table = (0, _reactTable.useReactTable)({
|
|
647
840
|
data: tableData,
|
|
648
841
|
columns: columnsForTable,
|
|
649
842
|
state: {
|
|
650
843
|
sorting: sorting,
|
|
651
844
|
columnSizing: columnSizing,
|
|
652
|
-
rowSelection: rowSelection
|
|
845
|
+
rowSelection: rowSelection,
|
|
846
|
+
// Add row selection state
|
|
847
|
+
pagination: memoizedPagination
|
|
653
848
|
},
|
|
654
849
|
onSortingChange: handleSortingChange,
|
|
655
850
|
onColumnSizingChange: handleColumnSizingChange,
|
|
851
|
+
onPaginationChange: setPaginationState,
|
|
656
852
|
getCoreRowModel: (0, _reactTable.getCoreRowModel)(),
|
|
657
853
|
// Only use pagination model for client-side pagination
|
|
658
|
-
getPaginationRowModel: isServerSidePagination ? undefined : (0, _reactTable.getPaginationRowModel)(),
|
|
854
|
+
getPaginationRowModel: isServerSidePagination() ? undefined : (0, _reactTable.getPaginationRowModel)(),
|
|
659
855
|
// Use sorted row model only for client-side sorting
|
|
660
856
|
getSortedRowModel: isServerSideSorting ? undefined : (0, _reactTable.getSortedRowModel)(),
|
|
661
857
|
enableSorting: enablesort,
|
|
@@ -667,15 +863,9 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
667
863
|
enableRowSelection: true,
|
|
668
864
|
// Enable row selection
|
|
669
865
|
// Use manual pagination and sorting for server-side operations
|
|
670
|
-
manualPagination: isServerSidePagination,
|
|
866
|
+
manualPagination: isServerSidePagination(),
|
|
671
867
|
manualSorting: isServerSideSorting,
|
|
672
|
-
pageCount: isServerSidePagination && datasource !== null && datasource !== void 0 && (_datasource$paginatio2 = datasource.pagination) !== null && _datasource$paginatio2 !== void 0 && _datasource$paginatio2.totalPages ? datasource.pagination.totalPages : undefined,
|
|
673
|
-
initialState: {
|
|
674
|
-
pagination: {
|
|
675
|
-
pageSize: initialPageSize,
|
|
676
|
-
pageIndex: initialPage - 1 // Convert to 0-based index
|
|
677
|
-
}
|
|
678
|
-
},
|
|
868
|
+
pageCount: isServerSidePagination() && datasource !== null && datasource !== void 0 && (_datasource$paginatio2 = datasource.pagination) !== null && _datasource$paginatio2 !== void 0 && _datasource$paginatio2.totalPages ? datasource.pagination.totalPages : undefined,
|
|
679
869
|
getRowId: function getRowId(row) {
|
|
680
870
|
return row._wmTableRowId || String(row.id) || (0, _lodashEs.uniqueId)("row_");
|
|
681
871
|
}
|
|
@@ -707,12 +897,15 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
707
897
|
sorting: sorting,
|
|
708
898
|
setInternalDataset: setInternalDataset,
|
|
709
899
|
showToast: showToast,
|
|
710
|
-
isServerSidePagination: isServerSidePagination,
|
|
900
|
+
isServerSidePagination: isServerSidePagination(),
|
|
711
901
|
pageIndex: table.getState().pagination.pageIndex,
|
|
712
902
|
onError: onError,
|
|
903
|
+
onBeforefilter: onBeforefilter,
|
|
713
904
|
setLoading: setLoading,
|
|
714
905
|
filterFields: memoizedFilterFields,
|
|
715
|
-
logicalOp: memoizedLogicalOp
|
|
906
|
+
logicalOp: memoizedLogicalOp,
|
|
907
|
+
listener: listener,
|
|
908
|
+
name: name
|
|
716
909
|
});
|
|
717
910
|
|
|
718
911
|
// Panel structure management
|
|
@@ -720,7 +913,7 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
720
913
|
title: title,
|
|
721
914
|
subheading: subheading,
|
|
722
915
|
iconclass: iconclass,
|
|
723
|
-
|
|
916
|
+
exportformat: exportformat,
|
|
724
917
|
headerActions: headerActions,
|
|
725
918
|
footerActions: footerActions,
|
|
726
919
|
shownavigation: shownavigation,
|
|
@@ -733,6 +926,25 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
733
926
|
showPanelHeading = _usePanelStructure.showPanelHeading,
|
|
734
927
|
showPagination = _usePanelStructure.showPagination;
|
|
735
928
|
|
|
929
|
+
// Callback: when pagination widget is ready, set table.dataNavigator = pagination widget proxy
|
|
930
|
+
var handlePaginationWidgetReady = (0, _react.useCallback)(function (paginationWidget) {
|
|
931
|
+
var _listener$Widgets2;
|
|
932
|
+
if (name && listener !== null && listener !== void 0 && (_listener$Widgets2 = listener.Widgets) !== null && _listener$Widgets2 !== void 0 && _listener$Widgets2[name]) {
|
|
933
|
+
listener.Widgets[name].dataNavigator = paginationWidget;
|
|
934
|
+
}
|
|
935
|
+
}, [name, listener]);
|
|
936
|
+
|
|
937
|
+
// Memoize sortInfo for export to prevent unnecessary re-renders
|
|
938
|
+
var sortInfoForExport = (0, _react.useMemo)(function () {
|
|
939
|
+
if (sorting.length > 0) {
|
|
940
|
+
return {
|
|
941
|
+
field: sorting[0].id,
|
|
942
|
+
direction: sorting[0].desc ? "desc" : "asc"
|
|
943
|
+
};
|
|
944
|
+
}
|
|
945
|
+
return undefined;
|
|
946
|
+
}, [sorting]);
|
|
947
|
+
|
|
736
948
|
// Update grid edit mode (includes inline editing and add new row)
|
|
737
949
|
var isGridEditModeComplete = isAddingNewRow || editingRowId !== null;
|
|
738
950
|
|
|
@@ -761,15 +973,15 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
761
973
|
}];
|
|
762
974
|
}
|
|
763
975
|
} else if (filtermode === "multicolumn") {
|
|
764
|
-
var activeFilters = Object.entries(columnFilters).filter(function (
|
|
765
|
-
var
|
|
766
|
-
_ =
|
|
767
|
-
filter =
|
|
976
|
+
var activeFilters = Object.entries(columnFilters).filter(function (_ref) {
|
|
977
|
+
var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
|
|
978
|
+
_ = _ref2[0],
|
|
979
|
+
filter = _ref2[1];
|
|
768
980
|
return filter.value;
|
|
769
|
-
}).map(function (
|
|
770
|
-
var
|
|
771
|
-
field =
|
|
772
|
-
filter =
|
|
981
|
+
}).map(function (_ref3) {
|
|
982
|
+
var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2),
|
|
983
|
+
field = _ref4[0],
|
|
984
|
+
filter = _ref4[1];
|
|
773
985
|
// Find column type for each field
|
|
774
986
|
var columnType = function (_col$meta4, _col$meta5) {
|
|
775
987
|
var col = (0, _lodashEs.find)(columnsForTable, function (c) {
|
|
@@ -806,12 +1018,11 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
806
1018
|
storage: effectiveStateHandler,
|
|
807
1019
|
currentPage: table.getState().pagination.pageIndex + 1,
|
|
808
1020
|
currentPageSize: table.getState().pagination.pageSize,
|
|
809
|
-
selectedRowId: selectedRowId,
|
|
810
1021
|
selectedRowIds: selectedRowIds,
|
|
811
1022
|
internalDataset: internalDataset,
|
|
812
1023
|
initialActualPageSize: initialActualPageSize,
|
|
813
1024
|
datasource: datasource,
|
|
814
|
-
multiselect:
|
|
1025
|
+
multiselect: effectiveMultiselect,
|
|
815
1026
|
filterData: filterDataForState,
|
|
816
1027
|
sortData: sortDataForState,
|
|
817
1028
|
navigation: navigation,
|
|
@@ -822,22 +1033,12 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
822
1033
|
initialFilterState: initialSearchState
|
|
823
1034
|
});
|
|
824
1035
|
|
|
825
|
-
// Use pagination state hook
|
|
826
|
-
var _usePaginationState = (0, _hooks.usePaginationState)({
|
|
827
|
-
table: table,
|
|
828
|
-
editmode: editmode,
|
|
829
|
-
internalDataset: internalDataset,
|
|
830
|
-
isAddingNewRow: isAddingNewRow,
|
|
831
|
-
cancelEditing: cancelEditing,
|
|
832
|
-
datasource: datasource,
|
|
833
|
-
isServerSidePagination: isServerSidePagination
|
|
834
|
-
}),
|
|
835
|
-
handlePaginationChange = _usePaginationState.handlePaginationChange,
|
|
836
|
-
handlePageSizeChangeBase = _usePaginationState.handlePageSizeChange;
|
|
837
|
-
|
|
838
1036
|
// Enhanced page size change handler with state persistence
|
|
839
1037
|
var handlePageSizeChange = (0, _react.useCallback)(function (newPageSize) {
|
|
840
|
-
//
|
|
1038
|
+
// Get old page size before updating for state persistence
|
|
1039
|
+
var oldPageSize = paginationState.pageSize;
|
|
1040
|
+
|
|
1041
|
+
// Call base handler from hook
|
|
841
1042
|
handlePageSizeChangeBase(newPageSize);
|
|
842
1043
|
|
|
843
1044
|
// Skip state persistence for Scroll navigation
|
|
@@ -846,7 +1047,7 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
846
1047
|
var currentPersistedState = (0, _utils.getTableState)(name, effectiveStateHandler);
|
|
847
1048
|
|
|
848
1049
|
// Build the state for page size change
|
|
849
|
-
var newState = stateManager.getStateForPageSizeChange(newPageSize, currentPersistedState === null || currentPersistedState === void 0 ? void 0 : currentPersistedState.selectedItem,
|
|
1050
|
+
var newState = stateManager.getStateForPageSizeChange(newPageSize, currentPersistedState === null || currentPersistedState === void 0 ? void 0 : currentPersistedState.selectedItem, oldPageSize // Pass the old page size
|
|
850
1051
|
);
|
|
851
1052
|
|
|
852
1053
|
// Clear the existing state first to avoid merge issues with setWidgetState
|
|
@@ -865,7 +1066,23 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
865
1066
|
}
|
|
866
1067
|
}
|
|
867
1068
|
}
|
|
868
|
-
}, [handlePageSizeChangeBase, name, effectiveStateHandler, stateManager, pagesize,
|
|
1069
|
+
}, [handlePageSizeChangeBase, name, effectiveStateHandler, stateManager, pagesize, navigation]);
|
|
1070
|
+
|
|
1071
|
+
// slectPageSize callback fix
|
|
1072
|
+
var selectPageSize = (0, _react.useCallback)(function (pagesize) {
|
|
1073
|
+
if (!allowpagesizechange && !pagesize) return;
|
|
1074
|
+
var pageSizeOptions = (pagesizeoptions || "5,10,20,50,100").split(",").map(function (v) {
|
|
1075
|
+
return Number(v.trim());
|
|
1076
|
+
}).filter(function (n) {
|
|
1077
|
+
return !Number.isNaN(n);
|
|
1078
|
+
}).sort(function (a, b) {
|
|
1079
|
+
return a - b;
|
|
1080
|
+
});
|
|
1081
|
+
if (pageSizeOptions.length === 0) return;
|
|
1082
|
+
var nv = Number(pagesize);
|
|
1083
|
+
var clamped = nv < pageSizeOptions[0] || nv > pageSizeOptions[pageSizeOptions.length - 1] || !pageSizeOptions.includes(nv) ? pageSizeOptions[0] : nv;
|
|
1084
|
+
handlePageSizeChange(clamped);
|
|
1085
|
+
}, [allowpagesizechange, pagesizeoptions, handlePageSizeChange]);
|
|
869
1086
|
|
|
870
1087
|
// Call data render callbacks for dynamic tables or when data changes
|
|
871
1088
|
(0, _react.useEffect)(function () {
|
|
@@ -875,12 +1092,12 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
875
1092
|
if (shouldCallCallbacks) {
|
|
876
1093
|
var currentPageIndex = table.getState().pagination.pageIndex;
|
|
877
1094
|
|
|
878
|
-
//
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
if
|
|
882
|
-
|
|
883
|
-
|
|
1095
|
+
// Update the tracked page index
|
|
1096
|
+
prevPageIndexRef.current = currentPageIndex;
|
|
1097
|
+
|
|
1098
|
+
// Only call callbacks if data has actually changed
|
|
1099
|
+
if (!(0, _lodashEs.isEqual)(prevDatasetRef.current, internalDataset)) {
|
|
1100
|
+
prevDatasetRef.current = internalDataset;
|
|
884
1101
|
|
|
885
1102
|
// Call onBeforedatarender callback
|
|
886
1103
|
if (onBeforedatarender) {
|
|
@@ -888,7 +1105,7 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
888
1105
|
// widget reference
|
|
889
1106
|
internalDataset,
|
|
890
1107
|
// data
|
|
891
|
-
|
|
1108
|
+
columnsProxy // columns (including dynamic ones)
|
|
892
1109
|
);
|
|
893
1110
|
}
|
|
894
1111
|
|
|
@@ -908,7 +1125,6 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
908
1125
|
}
|
|
909
1126
|
}
|
|
910
1127
|
}, [internalDataset, wmTableColumns, onBeforedatarender, onDatarender, name, isDynamicTable, table.getState().pagination.pageIndex]);
|
|
911
|
-
|
|
912
1128
|
// Use table initialization hook
|
|
913
1129
|
(0, _hooks.useTableInitialization)({
|
|
914
1130
|
internalDataset: internalDataset,
|
|
@@ -918,7 +1134,6 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
918
1134
|
useRadioSelect: useRadioSelect,
|
|
919
1135
|
useMultiSelect: useMultiSelect,
|
|
920
1136
|
setActiveRow: setActiveRow,
|
|
921
|
-
selectedRowId: selectedRowId,
|
|
922
1137
|
selectedRowIds: selectedRowIds,
|
|
923
1138
|
formName: formName,
|
|
924
1139
|
editmode: editmode,
|
|
@@ -933,7 +1148,6 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
933
1148
|
datasource: datasource,
|
|
934
1149
|
internalDataset: internalDataset,
|
|
935
1150
|
statehandler: effectiveStateHandler,
|
|
936
|
-
selectedRowId: selectedRowId,
|
|
937
1151
|
selectedRowIds: selectedRowIds,
|
|
938
1152
|
currentPage: table.getState().pagination.pageIndex + 1,
|
|
939
1153
|
// Convert to 1-based
|
|
@@ -1021,16 +1235,54 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
1021
1235
|
}
|
|
1022
1236
|
startEditing(row, row._wmTableRowId);
|
|
1023
1237
|
}, [startEditing]);
|
|
1024
|
-
var deleteRow = (0, _react.useCallback)(function (
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
return
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1238
|
+
var deleteRow = (0, _react.useCallback)(/*#__PURE__*/function () {
|
|
1239
|
+
var _ref5 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(event, widget, row) {
|
|
1240
|
+
var _listener$Widgets3, cleanedRow, rowIndex, result;
|
|
1241
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
1242
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1243
|
+
case 0:
|
|
1244
|
+
if (row) {
|
|
1245
|
+
_context.next = 3;
|
|
1246
|
+
break;
|
|
1247
|
+
}
|
|
1248
|
+
console.warn("Invalid row data provided to deleteRow");
|
|
1249
|
+
return _context.abrupt("return");
|
|
1250
|
+
case 3:
|
|
1251
|
+
if (!onBeforerowdelete) {
|
|
1252
|
+
_context.next = 11;
|
|
1253
|
+
break;
|
|
1254
|
+
}
|
|
1255
|
+
cleanedRow = (0, _utils.cleanRowData)([row])[0];
|
|
1256
|
+
rowIndex = internalDataset.findIndex(function (r) {
|
|
1257
|
+
return r._wmTableRowId === row._wmTableRowId || r.id !== undefined && r.id === row.id;
|
|
1258
|
+
});
|
|
1259
|
+
_context.next = 8;
|
|
1260
|
+
return onBeforerowdelete(event, listener === null || listener === void 0 || (_listener$Widgets3 = listener.Widgets) === null || _listener$Widgets3 === void 0 ? void 0 : _listener$Widgets3[name], cleanedRow, {
|
|
1261
|
+
rowIndex: rowIndex,
|
|
1262
|
+
data: cleanedRow
|
|
1263
|
+
});
|
|
1264
|
+
case 8:
|
|
1265
|
+
result = _context.sent;
|
|
1266
|
+
if (!(result === false)) {
|
|
1267
|
+
_context.next = 11;
|
|
1268
|
+
break;
|
|
1269
|
+
}
|
|
1270
|
+
return _context.abrupt("return");
|
|
1271
|
+
case 11:
|
|
1272
|
+
_deleteRecord(row, tableRef.current);
|
|
1273
|
+
case 12:
|
|
1274
|
+
case "end":
|
|
1275
|
+
return _context.stop();
|
|
1276
|
+
}
|
|
1277
|
+
}, _callee);
|
|
1278
|
+
}));
|
|
1279
|
+
return function (_x, _x2, _x3) {
|
|
1280
|
+
return _ref5.apply(this, arguments);
|
|
1281
|
+
};
|
|
1282
|
+
}(), [_deleteRecord, onBeforerowdelete, listener, name, internalDataset]);
|
|
1031
1283
|
|
|
1032
1284
|
// Refresh table data
|
|
1033
|
-
var refresh = (0, _react.useCallback)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function
|
|
1285
|
+
var refresh = (0, _react.useCallback)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
1034
1286
|
var newData,
|
|
1035
1287
|
_datasource$paginatio3,
|
|
1036
1288
|
currentTable,
|
|
@@ -1042,27 +1294,28 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
1042
1294
|
lastPage,
|
|
1043
1295
|
response,
|
|
1044
1296
|
dataWithIds,
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1297
|
+
_listener$Widgets4,
|
|
1298
|
+
_args2 = arguments;
|
|
1299
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
1300
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1048
1301
|
case 0:
|
|
1049
|
-
newData =
|
|
1302
|
+
newData = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : false;
|
|
1050
1303
|
if (datasource) {
|
|
1051
|
-
|
|
1304
|
+
_context2.next = 4;
|
|
1052
1305
|
break;
|
|
1053
1306
|
}
|
|
1054
1307
|
console.warn("No datasource available for refresh");
|
|
1055
|
-
return
|
|
1308
|
+
return _context2.abrupt("return");
|
|
1056
1309
|
case 4:
|
|
1057
|
-
|
|
1310
|
+
_context2.prev = 4;
|
|
1058
1311
|
// Use tableRef.current to access the latest table instance
|
|
1059
1312
|
currentTable = tableRef.current;
|
|
1060
1313
|
if (currentTable) {
|
|
1061
|
-
|
|
1314
|
+
_context2.next = 9;
|
|
1062
1315
|
break;
|
|
1063
1316
|
}
|
|
1064
1317
|
console.warn("Table instance not available");
|
|
1065
|
-
return
|
|
1318
|
+
return _context2.abrupt("return");
|
|
1066
1319
|
case 9:
|
|
1067
1320
|
targetPage = currentTable.getState().pagination.pageIndex + 1;
|
|
1068
1321
|
currentPageSize = ((_datasource$paginatio3 = datasource.pagination) === null || _datasource$paginatio3 === void 0 ? void 0 : _datasource$paginatio3.size) || currentTable.getState().pagination.pageSize;
|
|
@@ -1081,11 +1334,11 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
1081
1334
|
}
|
|
1082
1335
|
|
|
1083
1336
|
// For server-side pagination, use datasource invoke
|
|
1084
|
-
if (!isServerSidePagination) {
|
|
1085
|
-
|
|
1337
|
+
if (!isServerSidePagination()) {
|
|
1338
|
+
_context2.next = 20;
|
|
1086
1339
|
break;
|
|
1087
1340
|
}
|
|
1088
|
-
|
|
1341
|
+
_context2.next = 16;
|
|
1089
1342
|
return (0, _crudHandlers.refreshDataSource)(datasource, {
|
|
1090
1343
|
page: targetPage,
|
|
1091
1344
|
pagesize: currentPageSize,
|
|
@@ -1093,7 +1346,7 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
1093
1346
|
condition: memoizedLogicalOp
|
|
1094
1347
|
});
|
|
1095
1348
|
case 16:
|
|
1096
|
-
response =
|
|
1349
|
+
response = _context2.sent;
|
|
1097
1350
|
// The datasource should update its data property automatically
|
|
1098
1351
|
// which will trigger a re-render through the dataset prop
|
|
1099
1352
|
if (response && response.data) {
|
|
@@ -1108,7 +1361,7 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
1108
1361
|
});
|
|
1109
1362
|
}
|
|
1110
1363
|
}
|
|
1111
|
-
|
|
1364
|
+
_context2.next = 21;
|
|
1112
1365
|
break;
|
|
1113
1366
|
case 20:
|
|
1114
1367
|
// For client-side pagination, just set the page index
|
|
@@ -1116,43 +1369,111 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
1116
1369
|
currentTable.setPageIndex(targetPage);
|
|
1117
1370
|
}
|
|
1118
1371
|
case 21:
|
|
1119
|
-
|
|
1120
|
-
if (showToast) {
|
|
1121
|
-
showToast("Table refreshed successfully", "Success");
|
|
1122
|
-
}
|
|
1123
|
-
_context.next = 29;
|
|
1372
|
+
_context2.next = 28;
|
|
1124
1373
|
break;
|
|
1125
|
-
case
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
console.error("Error refreshing table data:",
|
|
1374
|
+
case 23:
|
|
1375
|
+
_context2.prev = 23;
|
|
1376
|
+
_context2.t0 = _context2["catch"](4);
|
|
1377
|
+
console.error("Error refreshing table data:", _context2.t0);
|
|
1129
1378
|
if (showToast) {
|
|
1130
1379
|
showToast("Failed to refresh table data", "Error");
|
|
1131
1380
|
}
|
|
1132
1381
|
if (onError) {
|
|
1133
|
-
onError(
|
|
1382
|
+
onError(null, listener === null || listener === void 0 || (_listener$Widgets4 = listener.Widgets) === null || _listener$Widgets4 === void 0 ? void 0 : _listener$Widgets4[name], _context2.t0, "refresh");
|
|
1134
1383
|
}
|
|
1135
|
-
case
|
|
1384
|
+
case 28:
|
|
1136
1385
|
case "end":
|
|
1137
|
-
return
|
|
1386
|
+
return _context2.stop();
|
|
1138
1387
|
}
|
|
1139
|
-
},
|
|
1140
|
-
})), [datasource, isServerSidePagination, setInternalDataset, showToast, onError]); // Removed 'table' from dependencies to prevent recreation
|
|
1388
|
+
}, _callee2, null, [[4, 23]]);
|
|
1389
|
+
})), [datasource, isServerSidePagination(), setInternalDataset, showToast, onError, listener, name]); // Removed 'table' from dependencies to prevent recreation
|
|
1390
|
+
|
|
1391
|
+
var tableApis = {
|
|
1392
|
+
columns: columnsProxy,
|
|
1393
|
+
addNewRow: handleAddNewRowClick,
|
|
1394
|
+
editRow: editRow,
|
|
1395
|
+
deleteRow: deleteRow,
|
|
1396
|
+
refresh: refresh,
|
|
1397
|
+
datasource: datasource,
|
|
1398
|
+
dataset: dataset,
|
|
1399
|
+
selectPageSize: selectPageSize
|
|
1400
|
+
};
|
|
1141
1401
|
|
|
1142
1402
|
// Expose table API through listener
|
|
1143
1403
|
(0, _react.useEffect)(function () {
|
|
1144
|
-
if (listener && listener.onChange) {
|
|
1145
|
-
listener.onChange(name,
|
|
1146
|
-
|
|
1147
|
-
addNewRow: handleAddNewRowClick,
|
|
1148
|
-
editRow: editRow,
|
|
1149
|
-
deleteRow: deleteRow,
|
|
1150
|
-
refresh: refresh,
|
|
1151
|
-
datasource: datasource
|
|
1152
|
-
});
|
|
1404
|
+
if (listener && listener.onChange && !tableApisRegistered.current) {
|
|
1405
|
+
listener.onChange(name, tableApis);
|
|
1406
|
+
tableApisRegistered.current = true;
|
|
1153
1407
|
}
|
|
1154
1408
|
}, []);
|
|
1409
|
+
|
|
1410
|
+
// Register table with parent form's formWidgets when parentForm is present
|
|
1411
|
+
(0, _react.useEffect)(function () {
|
|
1412
|
+
var _listener$Widgets5;
|
|
1413
|
+
if (parentForm && name && listener !== null && listener !== void 0 && (_listener$Widgets5 = listener.Widgets) !== null && _listener$Widgets5 !== void 0 && _listener$Widgets5[parentForm]) {
|
|
1414
|
+
var _listener$Widgets6;
|
|
1415
|
+
var _columns = listener === null || listener === void 0 || (_listener$Widgets6 = listener.Widgets) === null || _listener$Widgets6 === void 0 || (_listener$Widgets6 = _listener$Widgets6[name]) === null || _listener$Widgets6 === void 0 ? void 0 : _listener$Widgets6.columns;
|
|
1416
|
+
var defaultValues = Object.entries(_columns || {}).reduce(function (acc, _ref7) {
|
|
1417
|
+
var _ref8 = (0, _slicedToArray2["default"])(_ref7, 2),
|
|
1418
|
+
key = _ref8[0],
|
|
1419
|
+
value = _ref8[1];
|
|
1420
|
+
if ((value === null || value === void 0 ? void 0 : value.defaultValue) !== undefined) {
|
|
1421
|
+
acc[key] = value;
|
|
1422
|
+
}
|
|
1423
|
+
return acc;
|
|
1424
|
+
}, {});
|
|
1425
|
+
|
|
1426
|
+
// If all values are undefined, pass empty array, else pass object of default values
|
|
1427
|
+
var valuesToPass = Object.keys(defaultValues).length === 0 ? [] : defaultValues;
|
|
1428
|
+
if (parentFormColumns) {
|
|
1429
|
+
listener === null || listener === void 0 || listener.onChange(parentForm, {
|
|
1430
|
+
dataoutput: _objectSpread(_objectSpread({}, parentFormColumns), {}, (0, _defineProperty2["default"])({}, name, valuesToPass))
|
|
1431
|
+
});
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
}, [parentForm, parentFormColumns]);
|
|
1435
|
+
var updateSelectedItem = function updateSelectedItem() {
|
|
1436
|
+
if (!(listener !== null && listener !== void 0 && listener.onChange)) return;
|
|
1437
|
+
|
|
1438
|
+
// Helper to get row ID
|
|
1439
|
+
var getRowId = function getRowId(row) {
|
|
1440
|
+
return row._wmTableRowId || String(row.id);
|
|
1441
|
+
};
|
|
1442
|
+
|
|
1443
|
+
// Get selected rows based on selection mode
|
|
1444
|
+
var selectedRows = [];
|
|
1445
|
+
if ((useRadioSelect || useMultiSelect) && selectedRowIds.length > 0) {
|
|
1446
|
+
selectedRows = internalDataset.filter(function (row) {
|
|
1447
|
+
return selectedRowIds.includes(getRowId(row));
|
|
1448
|
+
});
|
|
1449
|
+
} else if (activeRowIds.length > 0) {
|
|
1450
|
+
selectedRows = internalDataset.filter(function (row) {
|
|
1451
|
+
return activeRowIds.includes(getRowId(row));
|
|
1452
|
+
});
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
// Clean and format selecteditem - always return as array
|
|
1456
|
+
var cleanedRows = (0, _utils.cleanRowData)(selectedRows);
|
|
1457
|
+
|
|
1458
|
+
// Always return selecteditem as an array (empty array if nothing selected)
|
|
1459
|
+
var selecteditem = cleanedRows.length > 0 ? cleanedRows : [];
|
|
1460
|
+
|
|
1461
|
+
// Update only if changed
|
|
1462
|
+
if (!(0, _lodashEs.isEqual)(prevSelectedRow.current, selecteditem)) {
|
|
1463
|
+
prevSelectedRow.current = selecteditem;
|
|
1464
|
+
listener.onChange(name, _objectSpread(_objectSpread({}, tableApis), {}, {
|
|
1465
|
+
selecteditem: selecteditem
|
|
1466
|
+
}));
|
|
1467
|
+
}
|
|
1468
|
+
};
|
|
1469
|
+
|
|
1470
|
+
// Expose active/selected row data through listener
|
|
1471
|
+
// This updates whenever the active/selected row changes (when user clicks on a row)
|
|
1472
|
+
(0, _react.useEffect)(function () {
|
|
1473
|
+
updateSelectedItem();
|
|
1474
|
+
}, [activeRowIds, selectedRowIds, useRadioSelect, useMultiSelect, internalDataset, name]);
|
|
1155
1475
|
return __jsx(_material.Box, {
|
|
1476
|
+
hidden: props.hidden,
|
|
1156
1477
|
className: "app-livegrid",
|
|
1157
1478
|
name: name
|
|
1158
1479
|
}, __jsx(_material.Box, {
|
|
@@ -1166,24 +1487,33 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
1166
1487
|
title: title,
|
|
1167
1488
|
subheading: subheading,
|
|
1168
1489
|
iconclass: iconclass,
|
|
1169
|
-
|
|
1490
|
+
exportformat: exportformat,
|
|
1170
1491
|
headerActions: headerActions,
|
|
1171
1492
|
spacing: spacing,
|
|
1172
1493
|
isGridEditMode: isGridEditModeComplete,
|
|
1173
1494
|
isLoading: datasource === null || datasource === void 0 ? void 0 : datasource.loading,
|
|
1174
|
-
listener: listener
|
|
1495
|
+
listener: listener,
|
|
1496
|
+
datasource: datasource,
|
|
1497
|
+
columns: wmTableColumns,
|
|
1498
|
+
sortInfo: sortInfoForExport,
|
|
1499
|
+
filterInfo: filterDataForState,
|
|
1500
|
+
exportdatasize: exportdatasize,
|
|
1501
|
+
onBeforeExport: onBeforeexport
|
|
1175
1502
|
}), __jsx(_material.Box, {
|
|
1176
1503
|
className: "app-datagrid",
|
|
1177
1504
|
onKeyDown: function onKeyDown(e) {
|
|
1178
1505
|
return handleTableEditKeyDown(e);
|
|
1179
1506
|
}
|
|
1180
1507
|
}, filtermode === "search" && __jsx(_components.GlobalSearchFilter, {
|
|
1508
|
+
filteronkeypress: filteronkeypress,
|
|
1181
1509
|
value: globalFilter,
|
|
1182
1510
|
onChange: setGlobalFilter,
|
|
1183
1511
|
selectedColumn: globalSearchColumn,
|
|
1184
1512
|
onColumnChange: setGlobalSearchColumn,
|
|
1185
1513
|
columns: columnsForTable,
|
|
1186
|
-
searchLabel: searchlabel
|
|
1514
|
+
searchLabel: searchlabel,
|
|
1515
|
+
name: name,
|
|
1516
|
+
listener: listener
|
|
1187
1517
|
}), __jsx(_material.Box, {
|
|
1188
1518
|
className: "table-container table-responsive"
|
|
1189
1519
|
}, __jsx(_material.Box, {
|
|
@@ -1195,19 +1525,23 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
1195
1525
|
overflow: "auto",
|
|
1196
1526
|
position: "relative"
|
|
1197
1527
|
}
|
|
1198
|
-
}, loading && __jsx(_LoadingComponent["default"], {
|
|
1528
|
+
}, loading && navigation !== "On-Demand" && __jsx(_LoadingComponent["default"], {
|
|
1199
1529
|
message: loadingdatamsg
|
|
1200
1530
|
}), __jsx(_material.Table, {
|
|
1201
1531
|
key: "table-".concat(isDynamicTable ? "dynamic" : "static", "-").concat(wmTableColumns.length, "-page-").concat(table.getState().pagination.pageIndex) // Force complete rebuild on pagination
|
|
1202
1532
|
,
|
|
1203
1533
|
className: "".concat(_utils.TABLE_CSS_CLASSES.gridDefault, " table-striped table-hover ").concat(spacingClasses).trim(),
|
|
1204
|
-
sx: {
|
|
1534
|
+
sx: _objectSpread({
|
|
1205
1535
|
width: props.width || "100%"
|
|
1206
|
-
},
|
|
1536
|
+
}, tableStructure && (0, _groupHeaderUtils.hasTableGroups)(tableStructure) ? {
|
|
1537
|
+
tableLayout: "fixed",
|
|
1538
|
+
minWidth: table.getTotalSize()
|
|
1539
|
+
} : {}),
|
|
1207
1540
|
name: name
|
|
1208
1541
|
}, showheader && wmTableColumns.length > 0 && __jsx(_components.TableHeaderComponent, {
|
|
1209
1542
|
table: table,
|
|
1210
1543
|
enablesort: enablesort,
|
|
1544
|
+
enablecolumnselection: enablecolumnselection,
|
|
1211
1545
|
rowClass: rowClass,
|
|
1212
1546
|
ColClassSignature: ColClassSignature,
|
|
1213
1547
|
sorting: sorting,
|
|
@@ -1219,7 +1553,12 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
1219
1553
|
columnFilters: columnFilters,
|
|
1220
1554
|
onColumnFilterChange: setColumnFilter,
|
|
1221
1555
|
renderFormWidget: renderFormWidget,
|
|
1222
|
-
listener: listener
|
|
1556
|
+
listener: listener,
|
|
1557
|
+
tableStructure: tableStructure,
|
|
1558
|
+
onColumnSelect: handleColumnSelect,
|
|
1559
|
+
onColumnDeselect: handleColumnDeselect,
|
|
1560
|
+
onHeaderclick: onHeaderclick,
|
|
1561
|
+
tableName: name
|
|
1223
1562
|
}), __jsx(_components.TableBodyComponent, {
|
|
1224
1563
|
table: table,
|
|
1225
1564
|
columns: columns,
|
|
@@ -1234,17 +1573,27 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
1234
1573
|
isLoading: datasource === null || datasource === void 0 ? void 0 : datasource.loading,
|
|
1235
1574
|
rowExpansionConfig: rowExpansionConfig,
|
|
1236
1575
|
expandedRows: expandedRows,
|
|
1237
|
-
toggleRowExpansion:
|
|
1576
|
+
toggleRowExpansion: handleToggleRowExpansion,
|
|
1238
1577
|
isRowExpanded: isRowExpanded,
|
|
1239
1578
|
rowsVersion: tableData.length,
|
|
1240
1579
|
ColClassSignature: ColClassSignature,
|
|
1241
|
-
tableData: tableData
|
|
1580
|
+
tableData: tableData,
|
|
1581
|
+
editingRowId: editingRowId,
|
|
1582
|
+
activeRowIds: activeRowIds,
|
|
1583
|
+
selectedRowIds: selectedRowIds,
|
|
1584
|
+
isAddingNewRow: isAddingNewRow
|
|
1585
|
+
}), summaryRowEnabled && summaryRowDefs.length > 0 && __jsx(_components.SummaryRowFooter, {
|
|
1586
|
+
summaryRowDefs: summaryRowDefs,
|
|
1587
|
+
summaryRowDefObjects: summaryRowDefObjects,
|
|
1588
|
+
columns: wmTableColumns,
|
|
1589
|
+
tableName: name,
|
|
1590
|
+
summaryRowColumnShow: summaryRowColumnShow
|
|
1242
1591
|
})))))), __jsx(_material.Box, {
|
|
1243
1592
|
className: "panel-footer clearfix"
|
|
1244
1593
|
}, showPagination && __jsx(_material.Box, {
|
|
1245
1594
|
className: "app-datagrid-paginator"
|
|
1246
1595
|
}, __jsx(_pagination["default"], {
|
|
1247
|
-
name:
|
|
1596
|
+
name: name,
|
|
1248
1597
|
dataset: filtermode ? filteredData : internalDataset,
|
|
1249
1598
|
maxResults: pagesize,
|
|
1250
1599
|
currentPage: table.getState().pagination.pageIndex + 1,
|
|
@@ -1258,8 +1607,10 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
1258
1607
|
pagesizeoptions: pagesizeoptions,
|
|
1259
1608
|
listener: listener,
|
|
1260
1609
|
onPaginationChange: handlePaginationChange,
|
|
1610
|
+
onSetRecord: onSetrecord,
|
|
1261
1611
|
onPageSizeChange: handlePageSizeChange,
|
|
1262
|
-
onDataUpdate:
|
|
1612
|
+
onDataUpdate: handleAccumulatedDataUpdate,
|
|
1613
|
+
onPaginationWidgetReady: handlePaginationWidgetReady
|
|
1263
1614
|
// Pass pagination metadata from datasource if available
|
|
1264
1615
|
,
|
|
1265
1616
|
paginationMeta: datasource === null || datasource === void 0 ? void 0 : datasource.pagination,
|
|
@@ -1269,16 +1620,21 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
1269
1620
|
datasource: datasource
|
|
1270
1621
|
// Pass server-side pagination flag
|
|
1271
1622
|
,
|
|
1272
|
-
isServerSidePagination: isServerSidePagination
|
|
1623
|
+
isServerSidePagination: isServerSidePagination()
|
|
1273
1624
|
// Pass additional invoke options for server-side operations
|
|
1274
1625
|
,
|
|
1275
|
-
datasourceInvokeOptions: isServerSidePagination ? {
|
|
1626
|
+
datasourceInvokeOptions: isServerSidePagination() ? {
|
|
1276
1627
|
orderBy: sorting.length > 0 ? sorting.map(function (s) {
|
|
1277
1628
|
return "".concat(s.id, " ").concat(s.desc ? "desc" : "asc");
|
|
1278
1629
|
}).join(", ") : undefined,
|
|
1279
1630
|
filterFields: memoizedFilterFields,
|
|
1280
1631
|
condition: memoizedLogicalOp
|
|
1281
1632
|
} : undefined
|
|
1633
|
+
// On-Demand navigation props
|
|
1634
|
+
,
|
|
1635
|
+
ondemandmessage: ondemandmessage,
|
|
1636
|
+
viewlessmessage: viewlessmessage,
|
|
1637
|
+
showviewlessbutton: showviewlessbutton
|
|
1282
1638
|
})), __jsx(_components.TableFooterActions, {
|
|
1283
1639
|
footerActions: footerActions,
|
|
1284
1640
|
spacing: spacing,
|
|
@@ -1288,7 +1644,7 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
1288
1644
|
}))));
|
|
1289
1645
|
}, function (prev, current) {
|
|
1290
1646
|
// Check if core data and configuration props are the same
|
|
1291
|
-
var keys = ["dataset", "editmode", "navigation", "pagesize", "showrowindex", "showheader", "enablesort", "radioselect", "radioselecttitle", "radioselectarialabel", "multiselect", "multiselecttitle", "multiselectarialabel", "gridfirstrowselect", "rowClass", "deleteoktext", "deletecanceltext", "confirmdelete", "errormessage", "nodatamessage", "loadingdatamsg", "insertmessage", "updatemessage", "deletemessage", "spacing", "title", "subheading", "iconclass", "allowpagesizechange", "pagesizeoptions", "datasource", "binddataset", "onSuccess", "onError", "onRowinsert", "onRowupdate", "onRowdelete", "statehandler", "filtermode", "children", "listener"];
|
|
1647
|
+
var keys = ["dataset", "editmode", "navigation", "pagesize", "showrowindex", "showheader", "enablesort", "radioselect", "radioselecttitle", "radioselectarialabel", "multiselect", "multiselecttitle", "multiselectarialabel", "gridfirstrowselect", "rowClass", "deleteoktext", "deletecanceltext", "confirmdelete", "errormessage", "nodatamessage", "loadingdatamsg", "insertmessage", "updatemessage", "deletemessage", "spacing", "title", "subheading", "iconclass", "allowpagesizechange", "pagesizeoptions", "datasource", "binddataset", "onSuccess", "onError", "onRowinsert", "onRowupdate", "onRowdelete", "onSort", "onBeforerowdelete", "onHeaderclick", "onRowselect", "onRowdeselect", "statehandler", "filtermode", "children", "listener", "hidden"];
|
|
1292
1648
|
|
|
1293
1649
|
// First check the simple props
|
|
1294
1650
|
var simplePropsEqual = keys.every(function (key) {
|
|
@@ -1305,7 +1661,14 @@ var WmTableComponent = exports.WmTableComponent = /*#__PURE__*/(0, _react.memo)(
|
|
|
1305
1661
|
return true;
|
|
1306
1662
|
});
|
|
1307
1663
|
WmTableComponent.displayName = "WmTableComponent";
|
|
1308
|
-
|
|
1664
|
+
|
|
1665
|
+
// Wrapper component that provides EditedRowsContext to WmTableComponent
|
|
1666
|
+
var WmTableWithProvider = function WmTableWithProvider(props) {
|
|
1667
|
+
return __jsx(_useEditedRows.EditedRowsProvider, null, __jsx(WmTableComponent, props));
|
|
1668
|
+
};
|
|
1669
|
+
|
|
1670
|
+
// @ts-ignore
|
|
1671
|
+
var WmTable = (0, _withBaseWrapper["default"])(WmTableWithProvider);
|
|
1309
1672
|
// Override the displayName set by withBaseWrapper
|
|
1310
1673
|
WmTable.displayName = "WmTable";
|
|
1311
1674
|
var _default = exports["default"] = WmTable;
|